Integrity constraint violation: 1052 Column 'uid' in on clause is ambiguous I am using migrate module to transfer data from one site to another here is my query

$query = Database::getConnection('db1', 'db1')
        -&gt;select('users', 'u');
$query-&gt;leftjoin('field_data_field_user_insti_name', 'insti_name', 'insti_name.entity_id = u.uid and insti_name.bundle = \'user\'');
$query-&gt;leftjoin('users_roles', 'ur', 'ur.uid = u.uid');
$query-&gt;fields('u', array('uid', 'name', 'mail', 'pass', 'status'));
$query-&gt;fields('insti_name', array('field_user_insti_name_target_id'));
$query-&gt;condition('u.uid', '1', '&gt;');
$query-&gt;condition('ur.rid', '6', '!=');
$query-&gt;distinct();


than I am getting this error 


  Integrity constraint violation: 1052 Column 'uid' in on clause is ambiguous


I found a solution for this problem that i have to add line

$this-&gt;source = new MigrateSourceSQL($query, array(), NULL, array('map_joinable' =&gt; FALSE));


After this error is solved, but don't know what this line do, is it safe to use this line
You have to add alias in MigrateSQLMap

$this-&gt;map = new MigrateSQLMap($this-&gt;machineName,  
   array(  
       'uid' =&gt; array(  
           'type' =&gt; 'int',  
           'not null' =&gt; TRUE,  
           'alias' =&gt; 'u',  
       )  
   ),  
) ;