繁体   English   中英

根据条件条件选择行,但根据特定的列值将其分组

[英]Select Rows based on Where Condition but group them based on a specific Column value

我想根据我的where子句从数据库中选择一些行,并根据某些条件对它们进行分组。

到目前为止,我已经做到了

SELECT col1, Encounter.EncounterId, col2, col3 FROM Abcd
Where SomeCondition
GroupBy Encounter.EncounterId

返回错误为:

不在聚合函数或group by子句中。

尝试这个 :

 SELECT col1, Encounter.EncounterId, col2, col3 FROM Abcd
 Where SomeCondition
 GroupBy col1, Encounter.EncounterId, col2, col3

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM