I have a SQL Server 2005 table with a column named CheckTime of datatype DateTime.
I need to run queries based on the date. For example:
- Select * where DatePart of Checktime (MM/DD/YYYY) = Today
- Select * where it was last week (assume Sunday - Saturday)
- Select * where it was last month (assume 1st - last day of month)
I can't figure how how to specify the inputs for comparison and compare those inputs to today. Can anyone please help me understand all the date comparison concepts and how to specify the date ranges?
Thanks in advance, DetRich
Aucun commentaire:
Enregistrer un commentaire