我需要選擇兩列。計算一列的總和並按原樣顯示它2.顯示列。所以我嘗試下面的代碼如何選擇具有聚合函數sql server的列
SELECT Sum(CONVERT(FLOAT, Replace(total, Char(0), ''))) AS Total,
[product name]
FROM tb_sales_entry_each_product
GROUP BY [sales date]
錯誤信息
Column 'tb_sales_entry_each_product.Product Name' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
在那裏我做error.thanks
您原來的查詢有一列在選擇語句和一個不同的列在組by子句。你需要改變的是把選擇語句的列按條目 – 2014-01-15 21:20:29