我知道怎么做 count
或采取 sum
但我的问题不同。
上面是我的名单。我想把我所有的3列数加起来 7+68+13....= sum
```
SELECT COUNT(DISTINCT od.meter_serial
) AS 'OGP Created',
COUNT(DISTINCT mp.meter_id
) AS 'Installed & Un-Verified Meters',
COUNT(DISTINCT ins.meter_msn
) AS 'Installed & Verified',
sd.sub_div_code
AS 'SD Code',sd.name
AS 'SD-Name'
FROM ogp_detail
od
INNER JOIN survey_hesco_subdivision
sd ON od.sub_div
= sd.sub_div_code
LEFT JOIN meter_ping
mp ON od.meter_id
= mp.meter_id
LEFT JOIN installations
ins ON od.meter_serial
= ins.meter_msn
WHERE od.meter_type
= '3-Phase'
GROUP BY sd.name
我希望计数的总和显示在每个 `3` 列同时显示计数。
任何帮助都将不胜感激。
1条答案
按热度按时间s5a0g9ez1#
或者简单地添加表达式
或者将查询设为子查询: