查询从以下屏幕截图获取每个不同位置的数量总和

时间:2017-03-22 06:59:33

标签: mysql

enter image description here

表应该是:

Factory1  DC_Westbengal  2000..........
Factory1  customer6      1000..........
Factory1  DC_Hyderabad   1000

1 个答案:

答案 0 :(得分:1)

您需要GROUP BY

SELECT Name, Loc, SUM(QTY) AS QTY
FROM dbo.tablename 
GROUP BY Name, Loc