我有這樣的SQL線錯誤在SQL SUM()
SELECT No_, sum(Quantity) AS Sold, [Shipment Date] AS SoldDate, [Item Category Code],
Description, [Description 2] FROM dbo.[3S Company A_S$Sales Invoice Line]
WHERE [Item Category Code] = '5104' GROUP BY No_
但我得到這個錯誤我的腳本。
Column 'dbo.3S Company A_S$Sales Invoice Line.Shipment Date' is invalid in the select
list because it is not contained in either an aggregate function or the GROUP BY clause.
任何人都可以幫我解釋爲什麼嗎?
假設你有2列在表中數據如下:NO_ = 1,數量= 10和20,裝運日期= 20140415和20140414,項目類別代碼= 3,說明=「bla」,說明2 = Bla2,你希望你的查詢返回爲銷售日期? – StephaneM