即使第二张桌子上没有匹配,我也想加入两张桌子。
表用户:
uid | name
1 dude1
2 dude2
表帐户:
uid | accountid | name
1 1 account1
我想要的表:
uid | username | accountname
1 dude1 account1
2 dude2 NULL
我正在尝试的查询:
SELECT user.uid as uid, user.name as username, account.name as accountname
FROM user RIGHT JOIN account ON user.uid=accout.uid
我得到了什么:
uid | username | accountname
1 dude1 account1