我有两个表(帐户和餐厅),如何显示两个表中的所有记录,但排除一些记录?
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,并且不显示管理记录:
先感谢您 :)