我有两个表(帐户和餐厅),如何显示两个表中的所有记录,但排除一些记录?table: account+-------+----------+------------+| uid | name | role |+-------+----------+------------+| 1 | John | Admin || 2 | Steve | Resto_Owner|| 3 | Bill | Customer |+-------+----------+------------+table: restaurant+--------+----------+------------+|resto_id| uid | resto_name |+--------+----------+------------+| 1 | 2 |Steve Resto |+--------+----------+------------+**This is my Desired Output:** +-------+----------+------------+--------------+| uid | name | role | resto_name |+-------+----------+------------+--------------+| 1 | John | Admin | || 2 | Steve | Resto_Owner| Steve Resto |+-------+----------+------------+--------------+我想显示角色为admin和resto_owner的这两个表中的记录。但如果角色是resto_owner,则也显示resto_name;如果是admin,则显示空白;如果customer,则不显示我尝试使用INNER JOIN,但它仅显示:2 Steve Resto_Owner Steve Resto,并且不显示管理记录:先感谢您 :)
1 回答
- 1 回答
- 0 关注
- 142 浏览
添加回答
举报
0/150
提交
取消