我有一个MySQL查询,其中我返回每个类别的平均薪水。关键是有些类别只有Q的工资而不是$,我想要显示两者,即使$不存在。
我的疑问是:
SELECT a.name, m.symbol, FORMAT(ROUND(AVG(c.salary)), 0) AS total
FROM people c
JOIN documentation cd
ON c.idpeople = cd.People_idpeople
JOIN cate_people cc
ON cc.id_docu = cd.id_docu
JOIN area a
ON a.idarea = cc.idcategory
JOIN coin m
ON m.id_coin = c.coin
WHERE c.date >= NOW() - INTERVAL 3 MONTH
AND c.salary < 50000
AND cd.fk_alliance = 1
GROUP BY cc.idcategory, m.id_coin;
给出这个结果:
-----------------------------
|Systems ---- Q ------ 4,514 |
|Systems ---- $ ------ 300 |
|Learng ----- Q ------ 3,551 |
|Admin ------ Q ------ 4,027 |
|Admin ------ $ ------ 2,438 |
-----------------------------
如何让Learng显示$列但值为零?
提前致谢!!!