In our PostgreSQL db, we have a table called 'tokens':
token_id | file_cc | file_cc2 | file_cc3 | file_ob
All the columns prefixed with 'file_' contain id's to the 'files' table:
file_id | name | location | hash
What I want is to select a token and to the resultset add the name and location from the files table for all the file columns.
With a JOIN this doesn't seem do-able, because you can only join on one column:
select * from tokens t
left join files f
on (t.file_cc = f.file_id)
Any ideas on this?