SQL : join with tables with same fields name (eg primary id) return invalid results |
Hi,
I noticed that if I build a query with 2 tables having the same name for primary key (and I guess this will be the case with any other field), the result is invalid as the id key in the resulting array contains only the id of the joined table. This is for example the case in the documentation : PHP Code: $builder->db->table('blog'); We should have 2 id keys (I know this isn't possible in php, but the name of the result array key should be blogs.id and comments.id) Sincerly, Fred
When there is a possible confusion of fields, it is then necessary to list them all in the SELECT with the name of the table first (i think)
This is in the forums here using search on How CodeIgniter join two tables to have both Id columns.
CodeIgniter Forums - How codeigniter join two tables to have both Id columns What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |