我创建了这个SQL语句:
SELECT *
FROM forum_question
LEFT JOIN forum_answer ON (
forum_question.id = forum_answer.question_id)
ORDER BY a_datetime DESC GROUP BY forum_question.id;
有谁知道这个问题? forum_question和forum_answer以及列'id'由by存在。
答案 0 :(得分:4)
GROUP BY
子句应该在ORDER BY
子句之前出现。尝试交换它,
GROUP BY forum_question.id
ORDER BY a_datetime DESC