my following query provokes the error message "Error: ORA-00905: missing keyword" but works with SQLite. I can't find the error.
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) as subResults
on subResults.customer_id = rental.customer_id) as subResults2
on inventory.inventory_id = subResults2.inventory_id) as 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