SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
select distinct customer.customer_id, customer.first_name, customer.last_name, count(rental.rental_id) as rental_count count(rental_id) from group by customer_id) as rental_count from customer inner join rental on customer.customer_id=rental.customer_id where rental_count>(select count(distinct rental_id )/count(distinct customer_id) from rental group by customer_id) group by customer.customer_id having rental_count>0 ;

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear