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)
 datediff

Author  Topic 

ranganath
Posting Yak Master

209 Posts

Posted - 2007-08-06 : 03:29:19
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)

17689 Posts

Posted - 2007-08-06 : 03:30:43
what bold rows ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

ranganath
Posting Yak Master

209 Posts

Posted - 2007-08-06 : 04:57:15
Firstrow, 4th row,6throw are Bold
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-08-06 : 05:00:20
oh, i must be blind



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


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

ranganath
Posting Yak Master

209 Posts

Posted - 2007-08-06 : 05:15:13
previous Record
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-08-06 : 05:19:39
quote:
Originally posted by ranganath

previous Record



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


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -