Suhaz
Because there's (implicit) inner joins on the cohorts tables, the query will only include users who are also in cohorts. If there are any students who have completions but are not in cohorts, it will skip them.
Compare the output you get with that query with one which has two left joins instead and you'll see the difference:
LEFT JOIN prefix_cohort_members as chm on chm.userid = u.id
LEFT JOIN prefix_cohort as ch on ch.id = chm.cohortid
That may or may not be the issue, but it would at least verify it is not
Randy