Jump to content

Help On Doing A Outer Join On Three Tables.


talk2toyin

Recommended Posts

I need to disply each logged on pupil's result to the pupil. I have three tables(a and B). Table 'a' is related to table 'b' by c_id....while table 'b' is related to an 'id' column in a different table. I need to display a list of all the courses, and scores in table 'a' and 'b' even if a score hasn't been assigned to any of the courses. Here's my source code:

 

$sql = "SELECT * FROM a

LEFT JOIN b ON a.c_id = b.c_id

WHERE b.stud_id = '$stud_id'

ODERE BY a.c_code";

 

$res = mysql_query($sql);

$nrows =mysql_num_rows($res);

 

for($i=0;$i<$nrows;$i++) {

//my output display loop goes in here.

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.