Do you have any other column that can relate a row in tablea to tableb beside the ssn ?if not, try thisdeclare @tablea table( ssn int, applicationtime datetime)declare @tableb table( ssn int, admissiontime datetime, dischargetime datetime)insert into @tableaselect 1234, '1/1/2005' union allselect 1234, '2/1/2006'insert into @tablebselect 1234, '1/9/2005', '1/23/2005' union allselect 1234, '2/7/2006', '3/31/2006'select a.ssn, a.applicationtime, b.admissiontime, b.dischargetimefrom( select ssn, applicationtime, row_no = (select count(*) from @tablea x where x.ssn = a.ssn and x.applicationtime <= a.applicationtime) from @tablea a) a inner join( select ssn, admissiontime, dischargetime, row_no = (select count(*) from @tableb x where x.ssn = b.ssn and x.admissiontime <= b.admissiontime) from @tableb b) bon a.ssn = b.ssnand a.row_no = b.row_no
KH