SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
with tt as (select *, rank() over (order by cnt desc) as rc from (select customer_id, count(*) cnt from rental join inventory using(inventory_id) group by customer_id) sq) select last_name, first_name, cnt from tt join customer using(customer_id) where rc <= 3 ; show status like 'Last_query_cost';

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear