title: Apply left join to extract data from multiple tables using their foreign key
body: <p>I have a table TblOrders which have two fields like FldOrderStatusId and FldInstrumentID as a foreign key from the tables called TblOrderStatus and TblInstrumentMasters respectively. Is that possible to left join for the table. The code is given below:</p>
  
  <pre><code>$find_filled_orders = $this-&gt;UserOrder-&gt;query(
      "Select distinct(FldOrderNumber) from TblOrders where FldOrderStatusId =12 ");
  $res_order="";
  $i=0;
  foreach($find_filled_orders as $order_arr)
  {
      if($i!=0)
      {
          $res_order.=",";
      }
      $res_order.="'".$order_arr['TblOrders']['FldOrderNumber']."'";
      $i++;               
   }
   $where_not_in="";
   if($i&gt;=1)
   {              
       $where_not_in =  "AND FldOrderNumber NOT IN (".$res_order.")";
   }
   //debugbreak(); 
   $current_order = $this-&gt;UserOrder-&gt;query(
       "Select * from TblOrders where 1 ".$where_not_in.
       " group by FldOrderNumber order by FldSlNo  desc"); 
  </code></pre>
  
  <p>I want to apply left join at the last line query. Please guys help me out.
  Thanks in advance.</p>