SQL server2008 多表联合查询,分页显示结果

时间:2022-01-26 03:28:08

  数据库两表联立查询所需数据,组合成新表,并结果以分页显示,例:

    select * from (select  row_number() over(order by a.id desc) as        

    row,a.id,b.ProjectName,a.LastSavePerson,b.ApplyDept,a.MakingPerson,b.ProjectLevel,b.ProjectType,a.TryDescription,a.Status,a.TryTime,

   a.MakingTime from tb_ProjectOnlineTry as a,tb_ProjectControl as b where 1=1  and a.MainID = b.MainID ) TT where tt.row between 1 and 12

   查询tb_ProjectOnline,tb_ProjectControl两表,将指定字段返回,并且一页只显示12条数据