Viewing 3 posts - 1 through 4 (of 4 total)
drew.allen (4/19/2012)
You're looking for the HAVING clause.
SELECT SerialNum, MAX(UsedDate) AS LastUsedDate
FROM YourTable
GROUP BY SerialNum
HAVING MAX(UsedDate) < DATEADD(YEAR, -1, GETDATE())
Drew
Yay!! Awesome, thank you very much. I didn't even know that...
April 19, 2012 at 2:36 pm
ColdCoffee (4/19/2012)
Need more clarification 🙂
SELECT DATEADD(MM,-12,GETDATE())give you 2011-04-19 11:12:01.653
Now if you had a row with April 2011, should that be neglected or should that be included?
OK, I should have used...
April 19, 2012 at 12:26 pm
Viewing 3 posts - 1 through 4 (of 4 total)