我尝试在 mysql 中进行更多高级查询,但查询出错,我尝试计数和分组。这是我的查询:
"select department,
(select count(id) from mcu group by dept) as tot1,
(select count(status_mcu) from mcu where status_mcu='done' group by dept) as tot2,
(tot1 - sum(select count(status_mcu) where status_mcu='done') as tot3,
FROM mcu"
你能帮我吗 ?我的查询有什么问题?我在其他线程中进行了一些搜索,这就是我得到的。尝试像这样查询:
"select department,
select count(id),
sum(case when status_mcu='done' then 1 end)
...
"
也没有工作。任何帮助表示赞赏。
我的 sql 版本是 5.5.25 – casthrotopes