Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Need help with DATEDIFF query

$
0
0

I have found several samples for this, but none are quiet the same as what I need to do (note: I am running this query in a vb.net form to an access database, not sql - still figured this was the best place for help).

I have a database with 2 columns that include both date and time.  I need to get that date difference between those columns where the hours are less than or equal to 24.  I have tried to do the query below but it didn't work.  Any assistance is greatly appreciated.

SELECT 
DATEDIFF(hh, column1, column2) AS DDiff FROM MyTable 
WHERE (DATEDIFF(hh, column1, column2) <= 24)



Viewing all articles
Browse latest Browse all 23857

Trending Articles