我知道在 mysql 中,我们可以禁用 ONLY_FULL_GROUP_BY 来对选定字段以外的其他字段进行聚合。但是在sql server中我不知道怎么做。
这是我尝试过的查询:
select Arrival_Date, sum(Rate)
from Stay
Group by month(Arrival_Date)
我收到以下错误:
Msg 8120, Level 16, State 1, Line 2
Column 'Stay.Arr_Date' is invalid in the select list because it is not
contained in either an aggregate function or the GROUP BY clause.