Joining three tables

From: Date: Sat, 16 Mar 2002 06:23:30 +0000
Subject: Joining three tables
Groups: php.db 
Request: Send a blank email to php-db+get-17704@lists.php.net to get a copy of this message
SQL QUERY question I have three tables: students has student_id and student_name parents has parent_id and parent_name parentlog has student_id and parent_id I want to search the parentlog WHERE student_id = some_id GROUP BY parent_id (This will bring back two rows when there are two parents) At the same time I want to get the name of the student that matches student_id and the name of the parent. I can LEFT JOIN students with parentlog USING(student_id) but I can't figure how I can join the parents so that I can get the name of match for the parent_id. Can I join three tables and search all in one pass? TIA John Hughes

« previous php.db (#17704) next »