SELECT
sc.`code` AS `机柜代码`,
COUNT(sg.cabinet_id) AS `网关数`
FROM
scada_gateway AS sg,
scada_cabinet AS sc
WHERE
sg.cabinet_id = sc.id
GROUP BY
sg.cabinet_id
ORDER BY
sc.id ASC
保存:
SELECT
sc.`code` AS `机柜代码`,
COUNT(sg.cabinet_id) AS `网关数`
FROM
scada_gateway AS sg,
scada_cabinet AS sc
WHERE
sg.cabinet_id = sc.id
GROUP BY
sg.cabinet_id
ORDER BY
sc.id ASC
保存: