
April 12th, 2008, 05:26 PM
|
|
Contributing User
|
|
Join Date: Apr 2007
Posts: 57
Time spent in forums: 15 h 55 m 23 sec
Reputation Power: 2
|
|
|
Joins - Multiple Join Repeats results
Hi,
I have been playing around with a join query that takes information out of three tables that match a candidates id. Now having been messing around with this for most of the day i have finally managed to get it to return all the information that i want and only the information that relates to the specific candidate.
The problem is it returns two sets of results, the first set that are a mixtire of records and the second set that is correct.
I am new to Joins and i am a bit lost so any help would be appreciated.
Thanks
PHP Code:
$sql = "SELECT joborder.title, candidate_joborder.date_submitted, candidate_joborder.status, site.name,candidate_joborder_status.short_descript ion FROM joborder LEFT JOIN candidate_joborder ON joborder.site_id = candidate_joborder.site_id LEFT JOIN site ON joborder.site_id = site.site_id LEFT JOIN candidate_joborder_status ON candidate_joborder_status.candidate_joborder_statu s_id = candidate_joborder.status WHERE candidate_id = '$candidate_id' ORDER BY name";
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($result)){
|