Oracle
 sql >> Datenbank >  >> RDS >> Oracle

Unterabfrage mit ungültigem Bezeichnerfehler in SQL

Sie müssen Ihre Join-Bedingungen in die Unterabfrage verschieben

SELECT tour_date AS "Departure Date",  site_name "Site Name"
FROM (
    SELECT res_id,tour_date,site_name, (res_partcost +NVL(RES_GEARCOST,0)) as "total_cost" 
    FROM reservation,site,tour
    WHERE reservation.tour_id = tour.tour_id
    AND tour.site_id = site.site_id ) Res1
WHERE Res1.total_cost > 230 // this will not be displayed in a result
GROUP BY tour_date, site_name;