sql >> Database teknologi >  >> RDS >> Oracle

ORACLE SQL:Manglende nøgleord

Prøv dette... Oracle understøtter ikke AS for 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. XAMPP MySQL-tjeneste går ned efter genstart

  2. Er der en måde at begrænse eller begrænse ressourcer, der bruges af en bruger i Oracle?

  3. Nummersekvens i MySQL

  4. SQLAlchemy datetime-operationer på serversiden