Forum OpenACS Q&A: Response to some advice on a search...

Collapse
Posted by Alex Sokoloff on

Well, I don't pass myself off as a sql guru either... But how about:

select distinct jo.job_id, jo.title
from job_offers jo, job_locations jl, offer_location_map olm
where jo.job_id = olm.job_id
and olm.location_id = jl.location_id
and jl.postal_code > :bind_variable

This won't work if you want to attach list of locations to each row. In that case you'll need to write a pgplsql function or do some processing of rows in tcl.