我试图制作一个mysql连接语句。我想加入Restauraunts的idRestauraunt和restaurant_categories的idRestauraunt。我的第二次加入我想加入category_categories的类别和idCategory的idCategories。我正在尝试使用的查询是
SELECT distinct r.* from Restaurants r
JOIN restaurant_categories rc on(r.idRestaurant = rc.idRestaurant )
JOIN Categories c on (c.idCategories =rc.idCategories )
WHERE c.Category ='Pizza Hut'
错误代码:1066。不唯一的表/别名:'餐馆'
分类
+--------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+-------------+------+-----+---------+-------+
| idCategories | int(11) | NO | PRI | NULL | |
| Category | varchar(45) | YES | | NULL | |
+--------------+-------------+------+-----+---------+-------+
餐馆
+--------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+-------------+------+-----+---------+-------+
| idRestaurant | int(11) | NO | PRI | NULL | |
| Name | varchar(45) | YES | | NULL | |
| Password | varchar(45) | YES | | NULL | |
| Email | varchar(45) | YES | | NULL | |
| Number | varchar(45) | YES | | NULL | |
+--------------+-------------+------+-----+---------+-------+
restaurant_categories
+--------------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+---------+------+-----+---------+-------+
| idCategory | int(11) | YES | MUL | NULL | |
| idRestaurant | int(11) | YES | MUL | NULL | |
+--------------+---------+------+-----+---------+-------+