WITH DetailsfromtblUserDetails AS (SELECT ROW_NUMBER() OVER (ORDER BY LastUpdatedDate_I130 Desc) AS RowNumber, * from Tracker_FB where I130Status != 'NULL' and WhoCanSeeThis='0' AND Preference=@Preference )SELECT *, case when (RowNumber = 1) then (select max(RowNumber) from DetailsfromtblUserDetails) else null end as maxRow FROM DetailsfromtblUserDetails WHERE RowNumber BETWEEN 1 AND 10
USA Family Based I-130 Tracker