Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select
- `products`.`product_id`, \
- `products`.`name`, \
- `products`.`price`, \
- `products`.`seller_id`, \
- `products`.`category`, \
- `products`.`body`, \
- (select
- truncate(avg(reviews.rating)+0.005,2) \
- from
- reviews \
- where
- reviews.product_id = '1002') as rate_avg, \
- (select
- count(reviews.product_id) \
- from
- reviews \
- where
- reviews.product_id = '1002') as review_ammount \
- from
- `products` \
- where
- `products`.`product_id` = '1002' limit 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement