我的SQL查询如下所示,它没有在第一个Inner Join上正确结束?如果我删除了第二个表和where子句,查询仍然正常?SQL命令未正确结束Oracle
SELECT homes.home_id, homes.title, homes.description, homes.living_room_count, homes.bedroom_count, homes.bathroom_count, homes.price, homes.sqft,
listagg(features.feature_name, '\n') WITHIN GROUP(ORDER BY features.feature_name) features, home_type.type_name
FROM homes, bookings
WHERE bookings.booking_end < date '2013-01-23' OR bookings.booking_start > date '2013-01-22' AND bookings.home_id <> homes.home_id
INNER JOIN home_feature ON homes.home_id = home_feature.home_id
INNER JOIN home_type ON home_type.type_code = homes.type_code
INNER JOIN features ON home_feature.feature_id = features.feature_id
GROUP BY homes.home_id, homes.title, homes.description, homes.living_room_count, homes.bedroom_count, homes.bathroom_count, homes.price, homes.sqft, home_type.type_name
任何人都可以看到我的查询有任何明显的错误吗?
建立你的模式。 –
做**不**混合隐式连接和显式连接语法。另外'JOIN'关键字在* WHERE子句之前。手册中的更多详细信息:http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_10002.htm#i2065646 –
你不能在那里放一个'where' – Xophmeister