分页SQL语句
做网站开发的都知道,显示列表项过多时会采取分页。本文主要讨论分页中的SQL语句,仅供参考。
以下是C#中的参数化的SQL语句片段,展示了分页时的情况:
string strSql = @"select top(@num) * from ( select id, c_info_title, count(*) over() AS Total, row_number() over(order by n_is_head, n_order desc, d_list_date desc, id desc) AS num from B_NEWS where n_is_active=1 )