Veran I am trying to do a series of exercises in MYSQL, using the SAKILA database, the problem that I have, is an exercise where I am asked for a query where I return the id
of a client, the amount of movies not rented and the name of these ... I already probe using left and right join and it gives me back the same ...
SELECT R.customer_id, Data.total AS Cnt_No_Alquilo, F.title
FROM rental R
LEFT JOIN inventory I ON R.inventory_id = I.inventory_id
LEFT JOIN film F ON I.film_id = F.film_id
INNER JOIN (SELECT R.customer_id, count(R.rental_id) total
from rental R
LEFT Join inventory I ON I.inventory_id = R.inventory_id
GROUP BY R.customer_id) Data ON R.customer_id = Data.customer_id
WHERE R.customer_id = 98