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.
当我尝试使用计数选择几列时,出现以下错误:
选定的非聚合值必须是关联组的一部分
我的查询是这样的。
SELECT COUNT(1), COLUMN1, COLUMN2 FROM TABLE-NAME
如果您要计算 COLUMN1 和 COLUMN2 的每个组合:
SELECT COUNT(1), COLUMN1, COLUMN2 FROM TABLE_NAME GROUP BY COLUMN1, COLUMN2
如果您要计算表中的所有记录:
SELECT COUNT(1) OVER (), COLUMN1, COLUMN2 FROM TABLE_NAME