在我的 SQL 表中,我想找到出现超过 300 次的状态代码,以及包含每个相应状态代码的记录的总行数。我的 SQL 有点生疏(加上星期一早上 8 点......),这就是我到目前为止所拥有的:
SELECT StateCode
FROM ZipCodeTerritory
HAVING COUNT(StateCode) > 300
SELECT StateCode, Count(*) As StateCodeCount
FROM ZipCodeTerritory
Group By StateCode
HAVING COUNT(*) > 300
像这样的东西?
SELECT StateCode, count(StateCode)
FROM ZipCodeTerritory
GROUP BY StateCode
HAVING COUNT(StateCode) > 300
SELECT StateCode, count(*)
FROM ZipCodeTerritory
GROUP BY StateCode
HAVING count(*) > 300