标签:des style blog color io 使用 strong 数据 div
id是指当前数据tb_id参数
方法一:
string preSql = "select top 1 * from table where tb_id < " + id + " order by tb_id DESC" string nextSql = "select top 1 * from table where tb_id > " + id + " order by tb_id ASC"
方法二:
string preSql = "select * from [table] where tb_id = (select MAX(tb_id) from [table] where tb_id<"+ id + ")"; string nextSql = "select * from [table] where tb_id = (select MIN(tb_id) from [table] where tb_id>"+ id + ")";
将查询结果union即可。
标签:des style blog color io 使用 strong 数据 div
原文地址:http://www.cnblogs.com/binyue/p/3966788.html