MySQL FULL JOIN not working but RIGHT and LEFT join works

后端 未结 4 1557
遥遥无期
遥遥无期 2020-12-19 03:20

This is driving me nuts. I have two tables that I am attempting to preform a join on, usersXstats and usersXstats_alltime.

Both tables have the same columns: id, us

4条回答
  •  一整个雨季
    2020-12-19 04:05

    FULL OUTER JOIN won't support in mysql.

    You can emulate FULL OUTER JOIN using UNION (from MySQL 4.0.0 on):

    with two tables usersXstats,usersXstats_alltime

    SELECT * FROM usersXstats
    LEFT JOIN usersXstats_alltime ON usersXstats.userId= usersXstats_alltime.userId
    UNION
    SELECT * FROM usersXstats
    RIGHT JOIN usersXstats_alltime ON usersXstats.statId= usersXstats_alltime.statId
    

提交回复
热议问题