mysql - SQL Where Date is greater than X -
i trying run query;
select po_purchaseorderdetail.itemcodedesc, po_purchaseorderdetail.quantityordered, po_purchaseorderdetail.quantityreceived, po_purchaseorderdetail.unitcost, po_purchaseorderdetail.jt158_wtsalesorderno, po_purchaseorderdetail.purchaseorderno, po_purchaseorderheader.purchasename, po_purchaseorderheader.purchaseorderdate po_purchaseorderdetail po_purchaseorderdetail, po_purchaseorderheader po_purchaseorderheader (po_purchaseorderdetail.purchaseorderno=po_purchaseorderheader.purchaseorderno) , ***(po_purchaseorderheader.purchaseorderdate > '2013-12-31')*** order po_purchaseorderdetail.jt158_wtsalesorderno, po_purchaseorderdetail.purchaseorderno
my problem is, date stored in yyyy-mm-dd format. need show data after date. so, because 2013-12-31 string rather number, operator > doesn't work. ideas?
try cast
string date
in following:
p.s. if purchaseorderdate
not date datatype cast it: cast(po_purchaseorderheader.purchaseorderdate date)
select po_purchaseorderdetail.itemcodedesc, po_purchaseorderdetail.quantityordered, po_purchaseorderdetail.quantityreceived, po_purchaseorderdetail.unitcost, po_purchaseorderdetail.jt158_wtsalesorderno, po_purchaseorderdetail.purchaseorderno, po_purchaseorderheader.purchasename, po_purchaseorderheader.purchaseorderdate po_purchaseorderdetail po_purchaseorderdetail, po_purchaseorderheader po_purchaseorderheader po_purchaseorderdetail.purchaseorderno = po_purchaseorderheader.purchaseorderno , po_purchaseorderheader.purchaseorderdate > cast('2013-12-31' date) order po_purchaseorderdetail.jt158_wtsalesorderno, po_purchaseorderdetail.purchaseorderno
Comments
Post a Comment