Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. select
  2. `products`.`product_id`, \
  3. `products`.`name`, \
  4. `products`.`price`, \
  5. `products`.`seller_id`, \
  6. `products`.`category`, \
  7. `products`.`body`, \
  8. (select
  9. truncate(avg(reviews.rating)+0.005,2) \
  10. from
  11. reviews \
  12. where
  13. reviews.product_id = '1002') as rate_avg, \
  14. (select
  15. count(reviews.product_id) \
  16. from
  17. reviews \
  18. where
  19. reviews.product_id = '1002') as review_ammount \
  20. from
  21. `products` \
  22. where
  23. `products`.`product_id` = '1002' limit 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement