Hi,
I'm trying to sort results using sets of conditions returning either 1 or 0.
The following sql is looking at two relational tables where tbljobs.id is related to tbljob_location.job_id
when the following is satisfied i get a duplication of the record-
each record seems identical except for Relevance which has value=1 in 1st instance and 0 in 2nd.
help would be appreciated
(the page itself is at )
I'm trying to sort results using sets of conditions returning either 1 or 0.
The following sql is looking at two relational tables where tbljobs.id is related to tbljob_location.job_id
Code:
SELECT distinct tbljobs.*,
(tbljobs.phase='Pre School' and tbljobs.id=tbljob_location.job_id AND tbljob_location.location_id='14') as Relevance FROM tbljobs,tbljob_location WHERE tbljobs.active='y' AND (tbljobs.phase='Pre School' or (tbljobs.id=tbljob_location.job_id AND (tbljob_location.location_id='5' or tbljob_location.location_id='14')) ) ORDER BY Relevance DESC limit 0, 5
Code:
tbljobs.id=tbljob_location.job_id AND tbljob_location.location_id='14'
each record seems identical except for Relevance which has value=1 in 1st instance and 0 in 2nd.
help would be appreciated
(the page itself is at )