Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
kam
Starting Member
17 Posts |
Posted - 2006-03-28 : 17:30:41
|
| I have a dateTime column which stores the date and time the record is added to the table. What I wish to do is use a query and select all the records which were added in the last 24 hours.I attempted this with the following statement, but to no luck:SELECT jobIDFROM jobRequestWHERE DATEDIFF(hour, dateReported, getdate() ) <= 24 Can someone provide any suggestions?Thanks. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-03-28 : 17:32:30
|
try thisSELECT jobIDFROM jobRequestWHERE dateReported >= DATEADD(day, -1, getdate()) KHChoice is an illusion, created between those with power, and those without.Concordantly, while your first question may be the most pertinent, you may or may not realize it is also the most irrelevant |
 |
|
|
kam
Starting Member
17 Posts |
Posted - 2006-03-29 : 12:43:28
|
| it works! thanks. |
 |
|
|
|
|
|