Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

Querying Data by certain Hour.

$
0
0

I have a visual studio program that is linked to my SQL database.  I am pulling values from that database and have created a report viewer in Visual Studio.  I want to ONLY pull data at 6:30 a.m.  2:30 p.m. and 11:30 p.m.  So far I can query this but I get results for ALL of 6, 2 and 11.  I ONLY want to return ONE value at those alotted times.  Here is my code so far. 

AND                   datepart(hh,[datetime]) in (6,2,11)



Viewing all articles
Browse latest Browse all 7129

Trending Articles