Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | 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
 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
17689 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
17689 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
17689 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  
 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.12 seconds. Powered By: Snitz Forums 2000