I am working with Codeigniter and MySQL. I have two table name as information and review.
Here I have attached image screenshot for my information table.
This is my review table
and this is my info_img table
Now, I want to get total no of review by information id as per mytable.
Here, I have written query like this :
SELECT
info.*,
info_img.name AS image,
COUNT(rev.review_id) AS total
FROM
information AS info
LEFT JOIN
info_img ON info.information_id = info_img.information_id
LEFT JOIN
review AS rev ON rev.information_id = info.information_id
WHERE
info.status = 1
AND FIND_IN_SET('3', info.category)
GROUP BY rev.information_id
ORDER BY info.information_id ASC
LIMIT 0 , 3
I got 18 review count for information_id = 8 that is wrong. Instead of it I want review count as 6 for information_id = 8.


