Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Where Clause to Return Records for Last 24 Hours

Status
Not open for further replies.

jw2000

Programmer
Aug 12, 2005
105
US
I have a datetime field, LastUpdate and I would like to return records with LastUpdate datetime within the last 24 hours. How can I do this?

Pseudocode:
Where LastUpdate is >= 24 hours ago ...
 
You can try:
Code:
select <columns>
from <table>
where datediff(hh, <col>, getdate()) <= 24
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top