To build a grid, all the distinct rows from T1 are required,
and only those from T2 which fall btn 2003-09-11 and 2003-09-18.
In the following example:
A is included because it is within the date range
C is inclucded because the date is null
B is excluded because it is outside the date range
Any suggestions on how to get the desired result would be greatly
appreciaed!
T1 T2
ID ID DATES
A A 2003-09-10
B B 2003-09-10
C A 2003-09-11
Desired Result
A 2003-09-11
B
C
Select T1.ID from T1 left join T2 on T1.ID = T2.ID
where (T2.DATES>=' 2003-09-11' and T2.DATES<=' 2003-09-18') or T2.DATES
is null
Result
A 2003-09-11
C
and only those from T2 which fall btn 2003-09-11 and 2003-09-18.
In the following example:
A is included because it is within the date range
C is inclucded because the date is null
B is excluded because it is outside the date range
Any suggestions on how to get the desired result would be greatly
appreciaed!
T1 T2
ID ID DATES
A A 2003-09-10
B B 2003-09-10
C A 2003-09-11
Desired Result
A 2003-09-11
B
C
Select T1.ID from T1 left join T2 on T1.ID = T2.ID
where (T2.DATES>=' 2003-09-11' and T2.DATES<=' 2003-09-18') or T2.DATES
is null
Result
A 2003-09-11
C
Comment