我想知道我在这个练习中做错了什么,其中SectionID是桌面上的一个关键餐厅餐厅和餐桌上的外键。
SELECT RestaurantName, Street, City, State, SectionID
FROM RestaurantSection, RestaurantTable
WHERE RestaurantSection.SectionID = RestaurantTable.SectionID
AND Restaurant.State = "NY"
答案 0 :(得分:1)
如果您阅读了错误消息,您可能会发现它显示的内容类似于对SectionID
的歧义。
撰写查询时,您应该:
JOIN
语法。所以,这样的事情(我猜测列的来源):
SELECT rs.RestaurantName, rs.Street, rs.City, rs.State, rs.SectionID
FROM RestaurantSection as rs INNER JOIN
RestaurantTable as rt
ON rs.SectionID = rt.SectionID
WHERE rs.State = "NY";