...

View Full Version : Returning rows older than 6 months.



sir pannels
08-11-2006, 09:34 AM
Morning all,

I have a DB packed with orders, and am trying to do a query that returns all the results that are older than 6 months, I wrote a query to find all results between now and six months ago but don't know how to return results older than six months and nothing more..

the date part of the query i had was...


DATE_SUB(CURDATE(),INTERVAL 6 MONTH) <= orderDat


If anyone has any pointers or link that be great, many thanks

Sir P :D

guelphdad
08-11-2006, 06:44 PM
select
foo,
bar,
qux
from yourtablename
where
orderDat <= DATE_SUB(CURDATE(),INTERVAL 6 MONTH)

sir pannels
08-24-2006, 12:39 PM
Many thanks, thats a simple turn around.. doh.. thank you :)

guelphdad
08-24-2006, 04:26 PM
ah, if it wasn't the small stuff then anyone could program and take the work away from the rest of us right? :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum