SQL query for asp.net grid pagination
问题 I am using iBatis and SQLServer , What is the best way for using offset and limit for pagging queries? Maybe I add the column ROW_NUMBER() OVER (ORDER BY Id) AS RowNum , but this will only prevent data access for simple queries. There is some cases that I use union of selects. How to optmize these queries? 回答1: I don't know anything about ibatis, but I guess you could do this in SQL. If I understand you correctly, you want to get paginate the results of a select statement or union of a few