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
 General SQL Server Forums
 New to SQL Server Programming
 Select only data for current month

Author  Topic 

sanlen
Starting Member

29 Posts

Posted - 2008-11-20 : 23:53:58
Hi All,

I have table as below

ID Project_Name Finish_Date
1 ABC 1/1/2009
2 DDDD 3/3/2008
3 CCC 20/11/2008
4 AAA 12/12/2008
5 XYZ 15/11/2008

I want to extract on the project which need to be finished in the current month.

Could you please advise?

Best Regard,
SANLEN

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-21 : 00:24:39
[code]SELECT ID ,Project_Name ,Finish_Date FROM YourTable WHERE Finish_Date>= DATEADD(mm,DATEDIFF(mm,0,GETDATE()),0)
AND Finish_Date< DATEADD(mm,DATEDIFF(mm,0,GETDATE())+1,0)[/code]
Go to Top of Page
   

- Advertisement -