select top 10 * From soft where id not in
(select top 1 id From soft where class='应用软件' order by ID desc)
order by ID desc高手指教下查出来的全是同一条数据 id 1-8的为了方便查看我把里面查询那个top值改成1 其实是 "当前页乘以每页显示的条数"
(select top 1 id From soft where class='应用软件' order by ID desc)
order by ID desc高手指教下查出来的全是同一条数据 id 1-8的为了方便查看我把里面查询那个top值改成1 其实是 "当前页乘以每页显示的条数"
(select top 1 id From soft where class='应用软件' order by ID desc)
order by ID desc
你这样写是排除了class='应用软件'的id最大的那条数据,然后取其他所有记录id最大的10条(包括class='应用软件'的,也包括不等于的,只排除了等于而且id最大的那一条数据)
如果你的逻辑确实是要这样,那就没错了,至于会不会显示10条,要看你总共符合条件的有多少
(select top 1 id From soft where class='应用软件' order by ID desc)
order by ID desc
(select top 1 id From soft where class='应用软件' order by ID desc)
order by ID desc
错了
比如说第二页,sql就应该是
select top 2×10 * From soft where id not in
(select top 1×10 id From soft where class='应用软件' order by ID desc)
order by ID desc
取出前20页,不包含前10页的,这才对你这个永远都是取前10条不包含第一条的