Skip to content

Instantly share code, notes, and snippets.

@ojgarciab
Last active February 12, 2023 20:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ojgarciab/a66be8c7408df23c9d996647ca8cafd5 to your computer and use it in GitHub Desktop.
Save ojgarciab/a66be8c7408df23c9d996647ca8cafd5 to your computer and use it in GitHub Desktop.
UPDATE tbl_order O
SET O.total = (
SELECT SUM(OD.quantity*MI.price)
FROM tbl_orderdetail OD
LEFT JOIN tbl_menuitem MI
ON OD.itemID = MI.itemID
WHERE OD.orderID = O.orderID
)
WHERE O.orderID = ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment