2013-02-26 70 views
0

我收到此查詢systax錯誤。左JOIN語法錯誤

SELECT 
    e.post_id as id, e.start as start_date, 
    p.post_title, 
    c.name as category 
FROM 
    wp_ai1ec_events as e LEFT_JOIN wp_term_relationships as t ON e.post_id = t.object_id 
    LEFT_JOIN wp_term_relationships as t ON e.post_id = t.object_id 
    LEFT_JOIN wp_terms as c ON c.term_id = t.term_taxonomy_id 
    LEFT_JOIN wp_posts as p ON p.ID = e.post_id 
GROUP BY e.post_id 

其實我可能甚至不需要左連接在這種情況下,因爲所有要重視一個行...

Error: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LEFT_JOIN wp_term_relationships as t ON e.post_id = t.object_id LEFT_JOIN w' at line 6 

任何幫助,將不勝感激。謝謝。

回答

10

有一個在LEFT JOIN

LEFT_JOIN無底線應該是LEFT JOIN

+0

謝謝,我笨,這就是發生在你的代碼2年後。 – Jeremy 2013-02-26 14:34:26

+1

當問題很簡單的時候,總是令人沮喪的,但有些緩解。 – 2013-02-26 14:36:34

+0

我現在只得到一個結果,但我應該有更多的結果。任何想法 ? – Jeremy 2013-02-26 14:40:10