bpgillett Posted April 16, 2007 Share Posted April 16, 2007 hi. i have two tables . one table, 'competency_actions', has the unique id's for different actions ('action_id') and the action names ('action'). the other table, 'competency_log', has fields about these actions and the unique id's for the students ('r_id') who completed them. some actions are required and have the field, 'required', set to 1 in the 'competency_actions' table. i am trying to select any required actions from table 'competency_actions' that are not present in table 'competency_log' for a given student ('r_id'). i can't figure out how to limit the query to a particular student as 'r_id' is null in my LEFT JOIN. here's what i have so far with out specifying the 'r_id': $result1 = mysql_query( Link to comment https://forums.phpfreaks.com/topic/47242-left-join-problem/ Share on other sites More sharing options...
Barand Posted April 16, 2007 Share Posted April 16, 2007 Well, that's a start SELECT a.action FROM competency_actions a LEFT JOIN comptency_log l ON a.action_id = l.action_id and r_id = '$studentID' WHERE a.reuired = 1 AND l.action_id IS NULL Link to comment https://forums.phpfreaks.com/topic/47242-left-join-problem/#findComment-230434 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.