|
|
Q:做一个视图,需要显示多个表单的数据,并做出排序的效果,如何实现。
A:视图选择sql过滤模式,具体实现sql,类似于:- var sql="select @rownum:=@rownum+1 as item_名次,t2.* from (select t.domainid,@rownum:=0 ,t.yhmc as item_养户名, t.sl as item_总数 from (select yh.domainid,yh.ITEM_养户姓名 as yhmc, sum(line.sl) as sl from tlk_养户基本资料表 yh, grpz_dj head, grpz_mx line where yh.ITEM_养户ID = head.yhbm and head.djbh = line.lmdm group by yh.ITEM_养户姓名 order by sum(line.sl) desc) t limit 10) t2";
- sql;
复制代码 效果如下:
|
|