SELECT sum(AfterDiscount) AS
AfterDiscount,DATE_FORMAT(UpdateDate,'%d-%m-%Y')
as UpdateDate FROM tblsale where
date_format(UpdateDate,'Y-m-d')=date_format(now(),'Y-m-d')
AND BillType='s'
This query render the 28 th records instead today ,
i want to render records by today dates
Problem fixed,
SELECT sum(AfterDiscount) 开发者_如何学CAS
AfterDiscount,DATE_FORMAT(UpdateDate,'%d-%m-%Y')
as UpdateDate FROM tblsale where
date_format(UpdateDate,'%Y-%m-%d')=date_format(now(),'%Y-%m-%d') AND BillType='s'
Why not compare WHERE DATE(UpdateDate)=CURRENT_DATE()
? Why go the trouble of formatting?
EDIT
Further functions found here: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date
精彩评论