Join fix name conflict
kamov opened this issue · 4 comments
kamov commented
I have a join with 2 table that have the same field name.
But how to distinct the field names?
Usually I do like below:
"SELECT posts.* , categories.* FROM ...."
Now query is just "SELECT * FROM ...."
Thanks!
kamov commented
NOTE:
If I do this:
->select(['posts.* ', 'categories.* ']);
the fields with the same name is always merged
kamov commented
This is my query:
$db->from('posts')
->leftJoin('categories', ['posts.category_id' => 'categories.id', 'categories.id' => 2])
->where('posts.status', 1)
->where('categories.status', 1)
->select(['pages.*', 'categories.*'])
->sql();
kamov commented
If I run the query in phpmyadmin, then work fine, all fields are show. But with sparrow the same field name are merged.
kamov commented
fixed