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 2005 Forums
 Transact-SQL (2005)
 Query where date >= 1st of month

Author  Topic 

fralo
Posting Yak Master

161 Posts

Posted - 2010-03-23 : 17:29:57
Do you guys know a simple way to get the results where the date is greater or equal to the 1st of the current month?

select * from table where date_field >= '1st of current month date'

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-03-23 : 17:49:37
where date_field >= DateAdd(Month,DateDiff(Month,0,getdate()),0)



No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-03-23 : 17:52:02
Not my solution!
Found it here (thanks madhi):
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=58138


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

fralo
Posting Yak Master

161 Posts

Posted - 2010-03-23 : 17:53:32
hey thanks a lot! It works great.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-03-23 : 18:00:46
welcome


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -