2013-02-26 68 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