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.
Author |
Topic |
arch259
Starting Member
1 Post |
Posted - 2010-07-21 : 09:51:17
|
Tab1 ID date1 1/1/20071 1/5/20071 1/15/20071 1/28/20071 1/30/20072 5/4/20073 6/7/20074 5/5/2007 Tab2 ID date1 12/12/20061 1/5/20071 1/11/20071 2/10/20072 3/5/20072 4/5/20073 3/26/20073 3/31/2007 Output table ID date1 12/12/20061 2/10/20071 2/10/20072 3/5/20072 4/5/20073 3/26/20073 3/31/2007 I want all the records from table 2 where for each ID in table 2, tab2.date does not fall within +-5 days of any in table 1 for that ID.Thanks |
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2010-07-21 : 10:04:20
|
So what have you tried so far?A clue for you:on id = idand (t1.date > dateadd(dd,5,t2.date) OR t1.date < dateadd(dd,-5,t2.date)) |
 |
|
|
|
|