I have three tables. a>b>c tables. I want to totals separately each other and optimize query. My query is not giving the true counts.
TABLE: a
a
-----------
id
no
create_time
TABLE: b
b
-----------
id
no
TABLE: c
c
-----------
id
b_id
this query is not giving the true counts
SELECT
DATE( a.create_time ) AS date,
COUNT( a.id ) AS total_a,
COUNT( b.id ) AS total_b,
COUNT( c.id ) AS total_c
FROM
`a`
LEFT JOIN `b` ON `a`.`no` = `b`.`no`
LEFT JOIN `c` ON `b`.`id` = `c`.`b_id`
WHERE
( `a`.`status` = 1 )
GROUP BY
DATE( a.create_time )
ORDER BY
`date` DESC
LIMIT 20