分页sql
第一:
sql = "SELECT TOP " + pageCount + " * FROM b_jihua_xiangmu WHERE f_nb_jhid=" + jhid + " and f_nb_xmbm >(SELECT ISNULL(MAX(f_nb_xmbm),0) FROM ( SELECT TOP (" + pageCount + "* (" + page + "-1)) * FROM b_jihua_xiangmu where f_nb_jhid=" + jhid + "ORDER BY f_nb_xmbm ) as a )ORDER BY f_nb_xmbm";
第二:
select top 页大小 *
from table1
where id>
(select max (id) from
(select top ((页码-1)*页大小) id from table1 order by id) as T
)
order by id
第二种 页码等于1的时候 查询不出来值 不知道为什么