rito1
asked on
Syntax for DateTime column WHERE clause
Hi All,
I have a table with a datetime column and I need help querying this column to show records within the past 30 days.
Please could anyone share with me the syntax to achieve this.
Many thanks,
Rit
I have a table with a datetime column and I need help querying this column to show records within the past 30 days.
Please could anyone share with me the syntax to achieve this.
Many thanks,
Rit
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
if you have an index on DateColumn ,this will give you better results
Select * From yTable Where DateColumn >= dateadd(dd, -30, convert(varchar,getdate(), 112) )
Select * From yTable Where DateColumn >= dateadd(dd, -30, convert(varchar,getdate(),
ASKER