在navicat 8 for mysql 中写了个视图中的查询,单位那一列怎么变成这个样子了?
[img]http://dl.iteye.com/upload/attachment/610756/be6c7bc0-593f-3915-a50c-391a10973d46.jpg[/img]
语句如下:
select ifnull('p.plantorganization','合计') AS 单位
,sum((case when (p
.type
= 1) then 1 else 0 end)) AS 类型1
,sum((case when (p
.type
= 2) then 1 else 0 end)) AS 类型2
,count(0) AS 汇总
from test
.t_plant
p
group by p
.plantorganization
with rollup