左JOIN语法错误

时间:2013-02-26 14:31:50

标签: mysql sql left-join

我在此查询中收到systax错误。

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

任何帮助将不胜感激。感谢。

1 个答案:

答案 0 :(得分:10)

LEFT JOIN

中没有下划线

LEFT_JOIN应为LEFT JOIN