Hi Guys,I am trying to achieve pagination in my web app but I can't seem to get it right. I have searched high and low on the net for a solution but it has been fruitless so far. I would like to use ROW_NUMBER() function.SELECT DISTINCT TOP $limit tblInvoice.*, tblTrackingHQ.*, tblUsers.uTown FROM tblInvoice INNER JOIN tblTrackingHQ ON tblInvoice.invTrackNo = tblTrackingHQ.invTrackNo CROSS JOIN tblUsers (SELECT ROW_NUMBER() OVER (ORDER BY invTrackNo) AS row, * FROM tblInvoice) where tblUsers.uTown= '".$name."' AND tblTrackingHQ.invStatus <> 7 ORDER BY tblInvoice.invTrackNo
Could some please help me write a proper SQL statement to use for paging with ROW_NUMBER()Thanks