November 11th, 2003, 03:31 AM
hi. i need some help[ here.
how do i use the DateDiff function to select data that are posted in the last two weeks only [given all rows entered had a timestamp field]
November 12th, 2003, 01:34 PM
You can use GETDATE() to get the current datetime and DATEADD() with a negative offset to get a date two weeks ago, something like this:
SELECT * From Table
WHERE LogDate >= DATEADD(DAY, -14, GETDATE())
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
"I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo