日期:2014-05-17 浏览次数:20491 次
with result0 as ( select bId,bcId,ja,jb,jc from jtable )
select * from (
select ROW_NUMBER() OVER (order by b.bId,r.bbId) rownum,b.bId ,b.bname ,b.sN , r.bcid, r.ja, r.jb, r.jc,
from BSI b
left join Area area on b.areaId=area.areaId
right join result0 as r on r.bId=b.bId
) pagination where pagination.rownum between 1 and 10
SELECT *
FROM ( SELECT ROW_NUMBER() OVER ( ORDER BY b.bId, r.bbId ) rownum ,
b.bId ,
b.bname ,
b.sN ,
r.bcid ,
r.ja ,
r.jb ,
r.jc
FROM jtable AS r
LEFT JOIN BSI b ON r.bId = b.bId --#2.如果这儿能用 INNER JOIN 的话,应该会更快些
LEFT JOIN Area area ON b.areaId = area.areaId