帆软动态分页之单数据集行式报表(模板-引擎设设置启用及行数)

例1:单数据集联合查询行式分页报表()

定义分页查询SQL

SELECT *     
      FROM (    
            SELECT TOP ${    
                         if(fr_pagenumber == int((((fr_rowcount-1)/fr_pagesize)+1)),fr_rowcount - (fr_pagesize*(fr_pagenumber-1)),fr_pagesize)    
                         } *        
               FROM(    
                  SELECT TOP ${fr_pagesize*fr_pagenumber} a.dudao,b.dpmc ,sum(sl*sj) je
                      FROM kehu a
join sale b on  a.khmc=b.dpmc
where a.dudao='${dudao}'//条件可添加在此处
group by a.dudao,b.dpmc

                    ) AS e1 ORDER BY  dudao DESC   
             ) AS e2 ORDER BY dudao ASC  

例2:SQL视图分页转至(http://help.finereport.com/doc-view-996.html)

  1. with t_rowtable     
  2. as  
  3. (  
  4.     select row_number() over(order by object_id DESC) as row_number,* from sys.[all_columns] where 1=1  
  5. )  
  6. SELECT *     
  7.       FROM (    
  8.             SELECT TOP ${    
  9.                          if(fr_pagenumber == int((((fr_rowcount-1)/6)+1)),fr_rowcount - (6*(fr_pagenumber-1)),6)    
  10.                          } *        
  11.                FROM(    
  12.                     SELECT TOP ${6*fr_pagenumber} *     
  13.                       FROM t_rowtable ORDER BY row_number ASC      
  14.                     ) AS e1 ORDER BY row_number DESC   
  15.              ) AS e2 ORDER BY row_number ASC  

你可能感兴趣的:(帆软)