GigilinE

Untitled

Mar 18th, 2021 (edited)
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. select
  2. b.`ID` AS `ID`,
  3. c.`product_id` AS `product_id`,
  4. c.`prezzo` AS `prezzo`,
  5. c.`disponibili` AS `quantity_max`,
  6. a.`ID` AS `user_id`,
  7. b.`quantity` AS `quantity_ask`,
  8. (
  9. SELECT
  10. SUM(h.prezzo * g.quantity) AS total_price_prod
  11. FROM
  12. amz_usr as f inner join amz_cart as g on f.ID = g.user_id inner join amz_prod as h on g.product_id = h.product_id
  13. WHERE
  14. c.`product_id` = g.`product_id` AND a.`ID` = g.`user_id`
  15. ) AS `total_price_prod`
  16. from
  17. amz_usr as a inner join amz_cart as b on a.ID = b.user_id inner join amz_prod as c on b.product_id = c.product_id;
Add Comment
Please, Sign In to add comment