Join to a Query

October 1, 2012

Using the new SQL join syntax, you can join to a query rather than a table:

select * from album
inner join (select * from track where trk_name = 'Money') x on trk_album = abm_serial;

It's important to alias the subquery that you're joining on, otherwise you'll get an error.

Tags: sql postgres oracle