mercredi 3 septembre 2014

Add duplicate values in a table sql server


Vote count:

0




Select P.ProductName,WFS.Status,OI.Quantity,OI.Price from OrderItem As OI Inner Join Order As O On OI.OrderID = O.ID AND OI.ItemType = 1 Inner Join Product P On OI.ProductID = P.ID Inner Join WorfFlowStatus As WFS On O.StatusID = WFS.ID


This Query Returns the rows like below


ProductName Status Quantity, Price ABC Shipped 10 100 ABC Shipped 10 100 BCE Pending 20 200


Now i want to select the same product in one row but quantity and price should be added. For e.g


ABC Shipped 20 200

BCE Pending 20 200


(if status and productname is same than add the quantity and price and if product is not same than no addition in quantity and price. Please Help.



asked 32 secs ago







Add duplicate values in a table sql server

Aucun commentaire:

Enregistrer un commentaire