SELECT *
FROM (SELECT EntSys,School_code,school_name,ADMISSION_DATE,HP_Type,HP_CODE,HP_Name, ROW_NUMBER() OVER (PARTITION BY EntSys ORDER BY ADMISSION_DATE desc) rn
FROM [All Schools Excluding Nurseries]
WHERE HP_Type='SN' AND entsys = 003 ) sq
WHERE sq.RN = 1
|