Link to home
Start Free TrialLog in
Avatar of bapkins
bapkins

asked on

SQL Select all records 30 days prior

Hi All,
I am trying to create an sql select where query that will return all records that are 45 days old.

My date field is acocmp1.currsale.trandate

The current format for the date in that field is 2102-01-03 00:00:00

Cheers
Avatar of bapkins
bapkins

ASKER

45 days old from the current date....
Try this
SELECT * FROM currsale WHERE (DATEDIFF(CURDATE(),trandate) > 45)
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You could do:

SELECT * FROM table WHERE acocmp1.currsale.trandate > DATE_SUB(NOW(),INTERVAL 45 DAY)