SELECT t.[Admissions_key],t.MRN,t.hosp_code,t.adm_datetime,t.sep_datetime,t.Sequence,
ROW_NUMBER() OVER (PARTITION BY t.MRN,t.hosp_code,t1.[Admissions_key] ORDER BY t.[Admissions_key]) AS newro
FROM dbo.tempnewborn t
OUTER APPLY(SELECT TOP 1 [Admissions_key]
FROM...