title: How to use Left Join sql query result into a model gridview in yii
body: <p>This is the code,</p>
  
  <pre><code>$model=new Tblvehicle;
  
  $sql="Select tblvehicle.serial_no, tblmodel.description, tbluser.user_name, tbluser.user_code "
      . "From tblvehicle"
      . " left join tblmodel "
      . "on tblvehicle.model_code= tblmodel.model_code"
      . " left join tbluser"
      . " on tblvehicle.user_code=tbluser.user_code"; 
  $query= Yii::app()-&gt;db-&gt;createCommand($sql)-&gt;queryScalar();
  $dataProvider = new CSqlDataProvider($sql, array('totalItemCount'=&gt;$query));
  
  $this-&gt;render('index',array(
     'model'=&gt;$model,'dataProvider'=&gt; $dataProvider));
  </code></pre>
  
  <p>and this is my incomplete <code>Tblvehicle</code> grid view - </p>
  
  <pre><code>$this-&gt;widget('zii.widgets.grid.CGridView', array(
                'id'=&gt;'tblvehiclegrid',
                'dataProvider'=&gt;$dataProvider,
                'filter'=&gt;$model,
                'columns'=&gt;array(
  </code></pre>
  
  <p>Now how can I show those 4 columns <code>serial_no, description, user_name,</code> and <code>user_code</code>? Because these came from different tables, I don't know how to add them in.</p>
  
  <pre><code>'columns'=&gt;array(
  </code></pre>
  
  <p>Maybe the way I am trying to do it is also wrong. So please need some help in this, I am very new to Yii.</p>