2013-04-15 96 views
1

我創造了這個SQL語句:這個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存在。

回答

4

GROUP BY子句應該在ORDER BY子句之前先出現。嘗試改變它,

GROUP BY forum_question.id 
ORDER BY a_datetime DESC 
+1

工作完美!謝謝! – asbxzeeko

+0

不客氣':D' –