有join的sql语句如何写分页查询?

2024-12-27 05:33:08
推荐回答(2个)
回答1:

select * from (select top size * from (select top size*page a.*, b.name, b.id from table1 as a join table2 as b on a.id = b.id where a.effect = 1 order by a.date) order by a.date desc) order by a.date
你试一下,可能有些小错误

回答2:

left join on 的后面不是一样可以加where条件的么。或者你这样啊。把查询到的数据当成一个试图来操作select top 10 in(select a.professionalid,a.professionalname,a.professionaltxt,b.imgurl from kszj as a
left join img as b on a.professionalid = b.professionalid)。。。。。。。