Now there are two tables
ATable (questionnaire): ID, title
BTable (questionnaire completed by users): ID, a.id, user_id
Now we need to count the number of users answered by each questionnaire. How do we do this?
I can do two queries, but one sentence is not acceptable.
Forget to say, B table data is not necessarily
select title, count(user_id) total from a left join b on a.id=b.aid group by(b.aid) order by total DESC
bIs there any data that does not affect the table