SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Need sql querry for critical logic
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

aniletc37
Starting Member

1 Posts

Posted - 06/12/2012 :  10:25:02  Show Profile  Reply with Quote
Hi ,

I HAVE TABLE FOR EXAMPLE,

emp sal Arrivaldate
111 200 03-mar-2011
100 200 03-mar-2008
150 200 06-mar-2012
170 200 03-mar-2003
178 200 03-mar-2004
112 200 12-jun-2012-------------------->For Example THIS IS TABLE WE HAVE LOT OF RECORDS

I need querry to get based on this condition:Arrival Date is between Previous Year First Day Same Month And Current day.

sunitabeck
Flowing Fount of Yak Knowledge

5152 Posts

Posted - 06/12/2012 :  11:45:25  Show Profile  Reply with Quote
If arrivaldate column is of type DATETIME or SMALLDATETIME, then you can use a where clause like this:
WHERE
   arrivaldate >= DATEADD(month,DATEDIFF(month,0,GETDATE())-12,0)
   AND arrivaldate < GETDATE()
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000