If I had one job in my job_offers table and that job would have ten office_locations, your query would search all ten postal_codes of offers_locations but only one row of job_offers?
Didn't you forget: and lower(title) like lower('%$title%')?
Is there a call to see what exactly postgres is proceding with this search?
What do you mean with: "This won't work if you want to attach list of locations to each row."
What would be the difference if I used group by instead of distinct?
Thanks