我有 2 张桌子:
美国各州城市:
和 usstatescentroids:
SELECT state,COUNT(*) AS count FROM usStateCities GROUP BY state
给出每个州的城市数量
SELECT *
FROM (SELECT state, COUNT(*) AS count FROM usstatecities ) AS a,
usstatescentroids b
WHERE a.state = b.state
GROUP BY state
只给出美国的一个州和城市总数我想找到每个州的城市数量和每个州质心的坐标(经度,纬度)。
更正我已将状态更改为状态。我剪切并粘贴了较旧的语句。