I am looking for an optimal decision of how to get table values according to their date and time but within just ONE past hour.
I mean something in this way (a pseudocode):
SELECT value FROM Table WHERE date BETWEEN getdate() AND getdate()-ONE_HOUR
For the purpose of this question Table has these columns:
valuedate
Any useful snippet is appreciated 🙂
Description of the
DATEADDfunction:Returns a specified date with the specified number interval (signed integer) added to a specified datepart of that date.
More information: