PQTIII
IS-IT--Management
- Sep 21, 2004
- 110
I'm trying to query(SQL) data on a char field mm/dd/yyyy (record date). How do I query the data to show all records that are from yesterday?
Thanks pt
Thanks pt
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
select * from mytable where dateadd(dd, 0, datediff(dd, 0,cast([red]date[/red] as datetime))) = dateadd(day,-1,dateadd(dd, 0, datediff(dd, 0,getdate())))
Then you sayI'm trying to query(SQL) data on a [RED]char field[/RED] mm/dd/yyyy (record date)
So is it a char field or is it a small date time. If it is a small date time just remove the cast and it should work.The field I'm using is a [red]smalldatetime[/red] type