Nested query

here is the script if it can help?

       <section id="CompletedComponents" class="sectionLeft">
        <h3 class="pow">Completed Fire Safety Training Components</h3>
        	<?php 
    		$userid = $user->data()->id;
    		$rs = DB::getInstance()->get('fsattendances LEFT JOIN firesafety ON fsattendances.fireSafetyId = firesafety.id LEFT JOIN fstraining LEFT JOIN fscomponents ON fstraining.FSComponentId = fscomponents.id ON firesafety.id = fstraining.fireSafetyId', array( 'fsattendances.attendee', '=', $userid));
    		if($rs->count()){
    			echo '<table>';
    		
    				echo '<th class="th">Fire Safety Component</th><th class="th">Completed On</th>';
    					echo '<tr>';
    					  foreach($rs->results() as $list){
    						  echo	'<td class="tdLeft"> <a  href="firesafety.php?id='.escape($list->id).'">'.escape($list->componentTitle).'</a></td>';
    						  echo	'<td class="tdLeft">'.date ("F d, Y",strtotime($list->FSDate)).'</td>';
    					echo '</tr>';	
    						}	
    		}
    		else
    		  {echo 'You have not completed any Fire Safety Component Training';}
    		echo'</table>';
    		?>
        </section>
      
      
          <section class="sectionLeft">
        <h3 class="pow">Fire Safety Training Components that have NOT been completed yet</h3>
        	<?php 
    		$userid = $user->data()->id;
// this is the one that doesn't work/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    		$rs = DB::getInstance()->query(" 
    			SELECT fsattendances.attendee, fscomponents.componentTitle
    FROM fsattendances LEFT JOIN (fstraining LEFT JOIN fscomponents ON fstraining.FSComponentId=fscomponents.ID) ON fsattendances.fireSafetyId=fstraining.fireSafetyId
    WHERE (((fsattendances.attendee)!='$userid')");
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////    
    		
    
    		if($rs->count()){
    			echo '<table>';
    		
    				echo '<th class="th">Fire Safety Component</th>';
    					echo '<tr>';
    					  foreach($rs->results() as $list){
    						
    						  echo	'<td class="tdLeft"> <a  href="firesafety.php?id='.escape($list->id).'">'.escape($list->componentTitle).'</a></td>';
    						  Session::flash('home', '<<<----Click Fire Safety menu link to view all Fire Safety Components----->>>.');
    					echo '</tr>';	
    		
    					  }	
    		}else{echo 'There is no existing Fire Training Component at the monent';}
    		echo'</table>';
    		?>
        </section>