我有2個SQL查詢其中一個工作,但另一個給出錯誤。下面的查詢效果很好2個SQL查詢有什麼區別?
select /*ordered*/ coupon_address.coupon,merchant_address.id
from merchant_address,
coupon_address,
customers c
WHERE merchant_address.id = coupon_address.merchant_address
and c.CUSTOMER_ID = 'temp1'
AND sdo_within_distance(c.cust_geo_location,merchant_address.store_geo_location,'distance = 1 unit=MILE') = 'TRUE';
但下面的查詢不起作用,並且給出了一個錯誤
select /*ordered*/ coupon_address.coupon,merchant_address.id
from coupon_address,
customers c
JOIN merchant_address ON merchant_address.id=coupon_address.merchant_address
WHERE c.CUSTOMER_ID = 'temp1'
AND sdo_within_distance (c.cust_geo_location,merchant_address.store_geo_location, 'distance = 1 unit=MILE') = 'TRUE';
錯誤是
ERROR位於第1行:ORA-00904: 「COUPON_ADDRESS」。 「MERCHANT_ADDRESS」:無效標識符
您正在將舊的,古老的,過時的和脆弱的隱式聯接與顯式的'JOIN'運算符混合。不要這樣做。 –
如果使用ANSI語法,則必須將其用於所有表;如果您決定使用舊的Oracle連接語法(並且強烈建議不要這麼做),請對所有表執行 – Aleksej
@a_horse_with_no_name將過時的連接與JOIN混合,意味着什麼? – raju