sql >> Database >  >> RDS >> Oracle

ORACLE SQL:zoekwoord ontbreekt

Probeer dit,.. Oracle ondersteunt geen AS voor tabelalias.

WITH subA AS
       (SELECT customer.first_name
              ,customer.last_name
              ,customer.store_id
              ,film_id
        FROM   (SELECT customer_id
                      ,film_id
                FROM   inventory
                       JOIN (SELECT rental.customer_id
                                   ,rental.inventory_id
                             FROM   rental
                                    JOIN (SELECT customer_id
                                                ,SUBSTR(first_name, 1, 1)
                                                ,SUBSTR(last_name, 1, 1)
                                          FROM   customer
                                          WHERE  SUBSTR(first_name, 1, 1) = SUBSTR(last_name, 1, 1)
                                          AND    customer.store_id = 2) subResults
                                      ON subResults.customer_id = rental.customer_id) subResults2
                         ON inventory.inventory_id = subResults2.inventory_id) finalsubR
               JOIN customer ON customer.customer_id = finalsubR.customer_id)
    ,filmResults AS
       (SELECT *
        FROM   (SELECT title
                      ,rating
                      ,inventory.film_id
                      ,inventory_id
                FROM   inventory JOIN film ON inventory.film_id = film.film_id)
        WHERE  rating = 'PG')
SELECT   DISTINCT first_name
                 ,last_name
                 ,store_id
FROM     subA JOIN filmResults ON subA.film_id = filmResults.film_id
ORDER BY last_name



  1. Trage query na upgrade mysql van 5.5 naar 5.6

  2. MySQL &MariaDB Load Balancing met ProxySQL

  3. Converteren van mysql naar mysqli (mysql_fetch_array)

  4. Oracle-tabelgroei voorspellen