Tuesday, October 23, 2012

Get "2 days before" Dates


Get "2 days before" dates
SELECT * FROM Table1 WHERE DATEDIFF(day, CURRENT_TIMESTAMP, SampleDateField) = 2; 

Another sample usage of DATEDIFF
SELECT DATEDIFF(day, CURRENT_TIMESTAMP, SampleDateField) as 'Days' from Table1

No comments:

Post a Comment