Richard Albright <[email protected]> writes: > you could use distinct on > > select distinct on (fs.film.title, fs.film.year ) title, year > from fs.film left join fs.star on fs.film.id = fs.star.film > where fs.star.last = 'Sheen';
Thanks, I didn't know about "distinct on". This version uses the primary (surrogage) key: select distinct on (fs.film.id) fs.film.title, fs.film.year from fs.film left join fs.star on fs.film.id = fs.star.film where fs.star.last = 'Sheen'; DES -- Dag-Erling Smørgrav - [email protected] -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
