интересно же посмотреть, как оно работает!

1
2
3
4
5
6
7
8
9
SELECT
Review.id, Review.name, Review.parent_id, COUNT(DoctorReview.user_id)
FROM
reviews AS Review
LEFT JOIN doctor_reviews AS DoctorReview ON DoctorReview.option_id = Review.id AND DoctorReview.doctor_id = $doctor
WHERE
Review.review_id = 1
GROUP BY
Review.id