title: Need help in mysql RIGHT join
body: <p>here is mytable structure?</p>
  
  <pre><code>table:category
  id name
  1  x
  2  y
  
  table:subproduct
  id cat_id name myval
  1  1      xyz  test
  2  1      abc  test2
  </code></pre>
  
  <p>So basically i want to select all values from subproduct for each id of category table and show it in array in php?</p>
  
  <p>here is my PHP code</p>
  
  <pre><code>$sqlnew = "SELECT c.cat_id,c.cat_title,s.sub_id,s.sub_title,s.store_cashback FROM category c JOIN subproduct s ON c.cat_id = s.pid";
  $pdo = getDB();
  $stmtnew = $pdo-&gt;query($sqlnew);
  $resultnew = $stmtnew-&gt;fetchAll();
  var_dump($resultnew);
  </code></pre>
  
  <p>I am using PHP PDO.</p>