我有以下表格
- 问题 -> id、question_data、user_id
- 用户 -> id、fname、lname
- question_connect-> id、question_id、user_id
我最初的查询如下
select questions.id, questions.question_data, users.id, users.fname from questions, users where questions.user_id = users.id limit 30
但是在这里,我想统计该问题的用户数,所以我尝试了以下查询
select questions.id, questions.question_data, users.id, users.fname, count(questions_connect.id) from questions, users LEFT JOIN questions_connect ON `questions`.`id` = `questions_connect`.`question_id` where questions.user_id = users.id group by `questions_connect`.`id` limit 30
这显示错误
Unknown column 'questions.id' in 'on clause'
所以我们可以用自然加入和左加入打1个电话,如果是的话,我哪里出错了..?