Basically I have a db_select that has two left joins. And will be calling up two table fields with the same name. The fields have different data though, so I need to be able to have access to both in my results. In a normal query I’d set this in the SELECT - how can i do the same in db_select
SELECT table1.column AS column1, table2.column AS column2
FROM table1
LEFT JOIN table2
ON table1.column = table2.column
here's my code that i need to change
$query->leftjoin('migrate_map_emp', 'm', 'm.sourceid1 = i.ID');
$query->leftjoin('migrate_map_emplogo', 'ml', 'ml.sourceid1 = i.ID');
$query->fields('i', array('ID','Name'))
->fields('m', array('destid1'))
->fields('ml', array('destid1'));
[solved]
the above code works. I did a 'drush_print_r' on the rows returned at the second item is labelled ml_
[destid1] => 5 [ml_destid1] => 2
Many thanks for any help.