Guys,
Please take a look my script.
my object here is to get the most recent date from table 2.
what if the recent date from table 2 is less than the date from table 1?
Table1
Type-Date1
--------
1-2011-07-16
2-2011-07-16
3-2011-07-10
4-2011-07-10
Table2
Type-Date2
--------
1-2011-07-06
2-2011-07-07
3-2011-07-01
4-2011-07-01
Select
min(Date2)
From Table1 as a
Left outer join table2 as b
on a.type = b.type
and date2 > date1
regards,
JOV