mysql视图问题

在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

加我QQ:782372990 通过QQ交流下

select ifnull('p.plantorganization','合计') AS 单位 把这里的'p.plantorganization' 单引号去掉。如果不去掉会被认为是字符串 所以直接显示。去掉后会当作列名显示,就是里面的值,为空的显示“合计”否则显示里面的值