Overcoming ambiguous field error in SQL query

后端 未结 3 1905
野趣味
野趣味 2021-01-22 22:37

I have 4 tables and this query

SELECT tag.id, title
FROM tag
LEFT JOIN tag_map ON ( tag.id = tag_map.tag_id ) 
LEFT JOIN post ON ( post.id = post_id ) 
LEFT JOIN         


        
3条回答
  •  臣服心动
    2021-01-22 23:22

    SELECT 
    tag.id, 
    tag_map.title as tagmaptitle,
    post.title as posttitle,
    game.title as gametitle,
    video.title as viedotitle,
    FROM tag
    LEFT JOIN tag_map ON ( tag.id = tag_map.tag_id ) 
    LEFT JOIN post ON ( post.id = post_id ) 
    LEFT JOIN game ON ( game.id = post_id ) 
    LEFT JOIN video ON ( video.id = post_id ) 
    WHERE tag_slug =  "blizzard"
    ORDER BY tag_map.post_type
    

提交回复
热议问题