SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
with t1 as ( select distinct title, rating, case when rating="R" then 1 else 0 end as rnk, c.first_name, c.last_name from film f left join inventory i on f.film_id = i.film_id left join rental r on i.inventory_id = r.inventory_id left join customer c on r.customer_id = c.customer_id where first_name = "KATIE" and last_name = "ELLIOTT" ) select title, rating from t1 order by rnk desc, rating

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear