[thelist] mysql request return unique row

Pierre-Henri Lavigne lavigne at getphuture.com
Thu Sep 21 07:51:40 CDT 2006


For a search engine with php I send a mysql request joining multiple tables to 
get results about candidates. The fact is with specific options I can get 
multiple times the same rows. How can I do get unique candidate_id for 
examples ?

SELECT ca.candidate_id, ca.candidate_dob, cask.diploma_id, cask.work_years_id, 
cask.job_level_id FROM candidates as ca, candidates_skills as cask, 
candidates_to_events as caev, candidates_to_states as cast, 
candidates_to_work_categories as cawc WHERE cask.language_1_id='7' AND 
caev.event_id='2' AND ( cawc.work_category_id='7' OR 
cawc.work_category_id='10' OR cawc.work_category_id='24') AND 
(cast.state_id='14') AND ca.candidate_visibility='0' AND 
ca.candidate_id=cask.candidate_id AND ca.candidate_id=caev.candidate_id AND 
ca.candidate_id=cast.candidate_id AND ca.candidate_id=cawc.candidate_id AND 

I created my tables using FOREIGN KEY, etc... Should I use commands like JOIN 
or something like this ?

Thanks in advance

Pierre-Henri Lavigne
Cell Phone: +33618753267

More information about the thelist mailing list