我的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