这是我写的sql语句,请大神帮忙看一下,怎么实现按人次和总金额排序呢? sql语句: select mtszks.jblb as 疾病名称,count(mtzyjl.iid) as 病例数,sum(mtchargeinfo.amt) as 总费用 from mtzyjl,org,mtszks,mtchargeinfo where mtzyjl.iid=mtszks.mtzyjl and mtzyjl.iid=mtchargeinfo.mtzyjl and mtszks.iscurrent=1 and mtszks.isactive=1 and mtszks.org=org.iid and zyjlcysj> '${开始时间1} 00:00:00' and zyjlcysj<'${结束时间1} 23:59:59' and zyjlzyh<>-1 group by mtszks.jblb ${if 排序方式==0,"order by count(mtzyjl.iid) desc","order bysum(mtchargeinfo.amt) desc"} |
最佳回答 |
||||
0
|
|
|||
0
|
|
|||
0
|
|
|||
0
|
|
|||
0
|
|
|||
0
|
|
|||
0
|
|