Advertisement
GigilinE

Untitled

Mar 18th, 2021
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. select
  2. b.`ID` AS `ID`,
  3. c.`product_id` AS `product_id`,
  4. c.`nome_prodotto` AS `nome_prodotto`,
  5. c.`link_prodotto` AS `link_prodotto`,
  6. c.`img_link` AS `img_link`,
  7. c.`prezzo` AS `prezzo`,
  8. c.`disponibili` AS `quantity_max`,
  9. c.`venditore` AS `venditore`,
  10. c.`cat_it` AS `cat_it`,
  11. a.`user_login` AS `user_login`,
  12. a.`ID` AS `user_id`,
  13. a.`email` AS `email`,
  14. b.`quantity` AS `quantity_ask`,
  15. b.`date` AS `date`,
  16. (
  17. SELECT
  18. SUM(h.prezzo * g.quantity) AS total_price_prod
  19. FROM
  20. 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
  21. WHERE
  22. c.`product_id` = g.`product_id` AND a.`ID` = g.`user_id`
  23. ) AS `total_price_prod`,
  24. (
  25. SUM ( total_price_prod ) AS total_price
  26. ) AS `total_price`,
  27. from
  28. 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;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement