您想这样做:
SELECt categories.id, max(categories.slug), count(categories_questions.id) AS numberOfQuestionsFROM categoriesLEFT JOIN categories_questionsON categories.id = categories_questions.category_idgroup by categories.id
在
LEFT JOIN将确保没有问题类别获得与数= 0上市
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)