我想连接两个表,即使第二个表没有匹配项。
表用户:
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
https://stackoverflow.com/questions/16987322
复制相似问题