Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在数据库中有 50 个具有不同邮政编码的房产。我想获得每个邮政编码的总数。
我想显示这样的总数
92508 (10) 30238 (5) 90026 (8) 23601 (15)
通常,用于CONCAT构建字符串并COUNT使用GROUP BY特定值进行计数:
CONCAT
COUNT
GROUP BY
SELECT CONCAT(ZIPCode, ' (', COUNT(*), ')') FROM Properties GROUP BY ZIPCode