Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
SELECT c.first_name, c.last_name, c.email, a.address FROM ( SELECT r.*, ROW_NUMBER() OVER (PARTITION BY r.inventory_id ORDER BY r.rental_date DESC) AS row_number FROM rental r WHERE r.inventory_id = 30 ) AS rr JOIN customer c ON rr.customer_id = c.customer_id JOIN address a ON c.address_id = a.address_id WHERE rr.row_number = 1;

Stuck with a problem? Got Error? Ask AI support!

Copy Clear