Your Data
DECLARE @OrderDetails TABLE
(ProductID INT,ProductName VARCHAR(10), OrderQuantity INT)
INSERT INTO @OrderDetails VALUES
(1001,'abc',5),(1002,'abc',23),(2002,'xyz',8),
(3004,'ytp',15),(4001,'aze',19),(1001,'abc',7)
Query
Select ProductID, ProductName, Sum(OrderQuantity) AS Total
from @OrderDetails
Group By ProductID, ProductName ORDER BY ProductID
Result
+---------------------------------+
¦ ProductID ¦ ProductName ¦ Total ¦
¦-----------+-------------+-------¦
¦ 1001 ¦ abc ¦ 12 ¦
¦ 1002 ¦ abc ¦ 23 ¦
¦ 2002 ¦ xyz ¦ 8 ¦
¦ 3004 ¦ ytp ¦ 15 ¦
¦ 4001 ¦ aze ¦ 19 ¦
+---------------------------------+