if you're using SQL Server,
dateadd(DAY,0, datediff(day,0, created))
will return the day created
for example, if the sale created on '2009-11-02 06:12:55.000',
dateadd(DAY,0, datediff(day,0, created))
return '2009-11-02 00:00:00.000'
select sum(amount) as total, dateadd(DAY,0, datediff(day,0, created)) as created
from sales
group by dateadd(DAY,0, datediff(day,0, created))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…