Hi,

I have the following:

 $data = Database::table('divisions')
            ->join('restaurants', 'restaurants.id', '=', 'divisions.restaurant_id')
            ->run();

Both tables have columns id and name.

It should be matched with SELECT * FROM divisions JOIN restaurants ON restaurants.id = divisions.restaurant_id and it is matched (I've checked). But the result is different if the sql request above shows all columns of both tables then the result of query builder returns only columns of the restaurant table for columns where the names is the same. So I lost divisions.id and divisions.name columns.

It is not what I expect to get and it does not match the query result. I understand the reason but I think it is a kind of bug.

If I specify fields with table names in the select, it does not help as well - the last table's columns overwrite the previous one. So there is no way to get the data from other columns if names of the columns are the same in the different tables – but is is usual thing – there is no requirements in SQL to specify somehow the names of the columns or include there the table names.

I think it might be worth adding the table name to the column name in the join cases, just like MySQL does.