Add a test case where no dependent record exists for some of main records
Use LEFT JOIN instead of INNER JOIN

To make results of `counts_query` includes records of which count is 0