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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL Query to select all records created today, or yesterday etc..

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-12-23 : 20:11:30
Joost writes "I'm getting crazy! Is it so hard to make a SQL query to select all the records which were inserted today, or yesterday by filtering the datetime field?

I tried this:

Select * from Table
where datetimefield between getdate()-1 and getdate()
order by datetimefield desc

..and it works, BUT it gives the records from the last 24 hour I think and I want it to be just the records from today or yesterday!

Pleazze help me out here!

Joost"
   

- Advertisement -