SQLTeam.com | Weblogs | Forums

Subquery exclusion dilemma for Teradata


#1

I have the following data...
ITEM START END
J1 10/2 10/5
J2 10/2 10/5
J3 10/2 10/4
K1 10/30 10/31
L1 10/17 10/18
M1 10/11 10/13
I only want to keep the items-by set--that are within 2 days. The result SHOULD be that I only keep the K,L,& M sets. None of the J set should be kept, because at least one of the lines in the J set are outside 2 days.


#2

How do you define a set? By the first character of the value in the ITEM column? Or is there another column that enables you to identify sets?


#3

Yes, the first character determines the "set"


#4

Are your dates just mm/dd? (no year)


#5

I simply did not include the year.