[英]Select Rows based on Where Condition but group them based on a specific Column value
I want to Select some rows from the database based on my where clause and group them based on some condions. 我想根据我的where子句从数据库中选择一些行,并根据某些条件对它们进行分组。
I have done this till now 到目前为止,我已经做到了
SELECT col1, Encounter.EncounterId, col2, col3 FROM Abcd
Where SomeCondition
GroupBy Encounter.EncounterId
Returns an error is: 返回错误为:
not contained in an aggregate function or the group by clause.
不在聚合函数或group by子句中。
Try this : 尝试这个 :
SELECT col1, Encounter.EncounterId, col2, col3 FROM Abcd
Where SomeCondition
GroupBy col1, Encounter.EncounterId, col2, col3
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.