My sharing and discussion of topics in C#, WCF, WPF, Winforms, SQL, ASP.Net, Windows Service, Java Script .... with you all.
Thursday, September 20, 2012
SQL Update with inner joins
Important points in SQL Update:
(1) We can not update more than one table at a time.
(2) We can use INNER JOIN with UPDATE in following way (w.r.t database schema above):
UPDATE Ref_Order_Status_Codes
SET
order_status_description = 'Paid'
FROM Products AS PROD
INNER JOIN Customer_Orders_Products AS CUST_PROD ON PROD.product_id = CUST_PROD.product_id
INNER JOIN Customer_Orderss AS CUST_ORD ON CUST_PROD.order_id = CUST_ORD.order_id
INNER JOIN Ref_Order_Status_Codes AS REF ON REF.order_status_code = CUST.order_status_code
WHERE PROD.product_id = 'WKSO00045'
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment