-1
我已經MySQL查詢以下MySQL的自聯接返回空值
select a.agency_name, a.green ,b.red, c.amber
from (select count(action_status) as green, agency_name from tbl_actions
where action_status='In Progress' group by agency_name) a
join (select count(action_status) as red, agency_name from tbl_actions
where action_status='Delayed' group by agency_name) b on a.agency_name=b.agency_name
join (select count(action_status) as amber, agency_name from tbl_actions
where act_status='Completed' group by agency_name) c on a.agency_name=c.agency_name
並且它返回空值
我有在數據庫中填充這些字段與相關數據。
請您格式化您的查詢,以便我們可以閱讀它? –
只有當每個'agency_name'每種類型的'act_status'至少有一行時,該查詢纔有效 – GurV
沒有空值,這是空的結果。 –