SELECT * FROM (
SELECT tp.propID, tp.AddedDate, tp.PropType, tp.NoBedrooms, tp.ShortDesc, tp.City, tp.ReleaseDate,
ti.BinaryImage AS PropertyImage, ti.ImageID,
row_number() over ( partition by ti.PropID order by ti.PropID) rnum
FROM dbo.tbl_Properties tp
INNER JOIN dbo.tbl_propertyImages ti On tp.propID = ti.PropID
WHERE tp.AddedBy = @UserID) temp
WHERE rnum = 1
|