title: Check if combination of fields exist
body: <p>I have a query that displays the modules that are available for a student to enrol on and shows them in a list.. I would like it if the modules that student has enrolled on do not show in the list.  Once a student has enrolled on a module it is stored in a table called tbl_studentModule which has two fields, regNum ($studentID) and moduleID.</p>
  
  <p>What do I need to add to this query to only show the modules that are not already in the tbl_studentModule with the relevant regNum.</p>
  
  <p>EG I would lik the query to say something to the effect where the combination of regNum and moduleID do not already exist if tbl_studentModule.</p>
  
  <p>Here is what I have so far...</p>
  
  <pre><code>SELECT DISTINCT am.moduleID, m.moduleName, am.type, s.regNum, s.award
  FROM tbl_awardModules am
  LEFT OUTER JOIN tbl_module m ON am.moduleID = m.moduleID
  INNER JOIN tbl_awardLevels al ON am.awardLevelID = al.awardLevelID
  INNER JOIN tbl_award a ON al.awardID = a.awardID
  INNER JOIN tbl_student s ON a.awardID = s.award
  LEFT JOIN tbl_studentModules sm ON s.regNum = sm.regNum
  WHERE am.type &lt;&gt; 'C' AND sm.regNum = '$student_id' AND m.moduleName &lt;&gt; 'A_null_Choice' AND m.moduleName NOT LIKE '%Not Running%'
  </code></pre>
  
  <p>Hope that makes sense...</p>