In my table I have minute data about daily temperature measurements. The table looks like:
DateTime timestamp, Float temperature
I would like to have the temperatures on different dates between a certain interval and then only show the temperature between 7am and 8pm.
I know how to get the data between dates:
SELECT [timestamp],[temperature]
FROM [meteo_data]
WHERE [timestamp] BETWEEN '2012-11-10' and '2012-11-17'
How to I implement the time restriction (7am – 8pm) as well?
Thanks a lot!!
If you are on
SQL Server 2008 or above, you can useTIME datatypeEDIT: Also it is recommended to use
ISO (yyyymmdd)date format when using date as a string. i.e.