Hello,
I have a job table that as an FK to a states table which, of coourse, holds all the states.
The FK is state_id.
Essentially, when somebody searches, I use LIKE to compare the term to several different fields. The problem is that the query returns a result for every state. So, if teh result should return 3 jobs, it returns 153 (50 states + DC) * 3...
$q = "Select j.job_id, j.title, j.company, j.description, j.showStart_date, j.url, j.city, j.confirmCode, s.name FROM jobs j, states s WHERE j.tags LIKE '%$term%' OR j.description LIKE '%$term%' OR j.title LIKE '%$term%' AND j.state_id = s.state_id AND j.end_date > $now ORDER BY j.end_date ASC";
If I strip out the OR statements and only go with 1 LIKE statement, it works.
Any ideas?
Thanks in advance.