Find records produced in the last hour
- by justSteve
I have a smalldatetime field named myTime recording when the record was created. I need the syntax that selects records created within the last hour.
thought it would be:
and DATEDIFF("hh", datePart(hh, myTime), DatePart(hh, GETDATE()) < 1
where datediff
1) looks for hours;
2) looks at the hours portion of the data in myTime as starting;…