我想这样的代码:总和SQL列与加盟
Select C.CustomerNum
, C.Coupon
, C.name
, C.Surname
, Sum(P.Points)
From customers C
Join Points P
On P.CustomerNum = C.CustomerNum
Where C.Coupon = 'xxx-xxx-xxx-x';
我收到提示:
Msg 8118, Level 16, State 1, Line 1 Column 'C.CustomerNum' is invalid in the select list because it is not contained in an aggregate function and there is no GROUP BY clause.
你想SUM基于什么?该错误不言自明 – techspider
用于在同一行中获得总分 – user6927546
[列的原因在选择列表中无效,因为它未包含在聚合函数或GROUP BY子句中](http://堆栈溢出。com/questions/13999817/reason-for-column-is-invalid-in-the-select-list-because-it-is-not-contained-in-e) – techspider