I have an orders table with a datetime field. I'm trying to query orders that 
are x number of days back from today. Ex. Show me all orders 30 days back from 
now. 

SELECT  date(orderdate) as thedate, sum(ordertotal) AS ordersubtotal
FROM tblOrders 
where orderdate >= current_date() - 30
group by date(orderdate)

The query works, but it's returning orders all the way back to 2006 - Not 
correct! 

What's weird is, if I change the value from 30, to 7, It shows the correct 
orders. I can change it all the way up to 28, and it's correct. If you change 
it to 29, which runs into last month, it pulls EVERYthing. Very strange! 

Any ideas?

Thanks,
Will



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317188
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to