I think you want a window function (see for example http://www.postgresql.org/docs/9.1/static/tutorial-window.html )
Something like: SELECT name,title FROM ( SELECT artist.name,album.title,rank() OVER ( PARTITION BY artist.id ORDER BY album.date DESC ) as r FROM artist JOIN album ON artist.id = album.artist_id ) x where r=1; (tested in Postgres) -- Dakkar - <Mobilis in mobile> GPG public key fingerprint = A071 E618 DD2C 5901 9574 6FE2 40EA 9883 7519 3F88 key id = 0x75193F88 Abracadaver: Now you meet your doom!
signature.asc
Description: PGP signature