select top(100) percent
ID
,AddressID
from
(
SELECT
ID
,rn = row_number() over (partition by ID order by ID, AddressID)
FROM [dbo].[Fac]
INNER JOIN [dbo].[FacAddress] ON Fac.ID = FacAddress.ID
) A
where (a.rn = 1)
order by FacilityID