計數(B組)我想運行SQL Server的查詢,以便從另一個表SQL服務器選擇A. *,通過
select a.*, count(b.number) from tableA a
inner join tableB b on a.id = b.a_id
group by a.id;
此選中所有的表(表A)與集料的元素給出以下錯誤:
Error: Column 'a.id' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
SQLState: S1000
ErrorCode: 8120
什麼是正確的查詢來得到我想要的?