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 2005 Forums
 Transact-SQL (2005)
 datediff
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ranganath
Posting Yak Master

209 Posts

Posted - 08/06/2007 :  03:29:19  Show Profile  Reply with Quote
Employee Date Enquired Title Company
Bryan Cole 2007-05-01 Recruiter ABC

Bryan Cole 2007-05-15 Recruiter ABC

Bryan Cole 2007-05-21 Recruiter ABC
Bryan Cole 2007-06-15 Recruiter ABC

Bryan Cole 2007-07-01 Recruiter ABC
Bryan Cole 2007-07-30 Recruiter ABC

I have to do row by row date comparisons in a date column. If the date difference is more than 30 days we keep it , otherwise we suppress it. How can we write the query without using cursor so that only the bold rows will come ?

khtan
In (Som, Ni, Yak)

Singapore
17598 Posts

Posted - 08/06/2007 :  03:30:43  Show Profile  Reply with Quote
what bold rows ?


KH
Time is always against us

Go to Top of Page

ranganath
Posting Yak Master

209 Posts

Posted - 08/06/2007 :  04:57:15  Show Profile  Reply with Quote
Firstrow, 4th row,6throw are Bold
Go to Top of Page

khtan
In (Som, Ni, Yak)

Singapore
17598 Posts

Posted - 08/06/2007 :  05:00:20  Show Profile  Reply with Quote
oh, i must be blind



The 30 days is from which date ? previous record ? Can you explain why row 4 is consider ?


KH
Time is always against us

Go to Top of Page

ranganath
Posting Yak Master

209 Posts

Posted - 08/06/2007 :  05:15:13  Show Profile  Reply with Quote
previous Record
Go to Top of Page

khtan
In (Som, Ni, Yak)

Singapore
17598 Posts

Posted - 08/06/2007 :  05:19:39  Show Profile  Reply with Quote
quote:
Originally posted by ranganath

previous Record



Then why do you want record 4 ? it is only < 30 days from record 3


KH
Time is always against us

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.08 seconds. Powered By: Snitz Forums 2000