title: join query not fetching any data
body: <p>i am trying to write my first join query which will help me to join two different tables,one is for students and other is for subjects.This is my first join query and it seems it is not working,can anyone point out the mistakes.Php didn't show any error or worning</p>
  
  <p><a href="https://i.stack.imgur.com/xfiqy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xfiqy.png" alt="enter image description here"></a> <a href="https://i.stack.imgur.com/WHMsm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WHMsm.png" alt="enter image description here"></a></p>
  
  <pre><code>   try{
       $pdo=new PDO("mysql:host=localhost;dbname=mydb",'root','');
       $sql="SELECT * FROM students LEFT JOIN subjects WHERE students.courseid=subjects.courseid";
       $conn=$pdo-&gt;prepare($sql);
        if($conn-&gt;execute()){
          $results=$conn-&gt;fetchAll();
          print_r($results);
        }
       }catch(PDOException $e){
           echo $e-&gt;getMessage();
       }
  </code></pre>