vrana/notorm — Issue #36: Column Ambiguity on Multiple Join
Author: wendynovianto
Created: 2011-12-27 16:04:21+00:00
State: open

If I have 2 tables with the same column name and use them together as a where condition, then it will triggers ambigue error from MySql.

Take a look this sample tables below:
- user: id, name, email
- question: id, user_id, text, html
- answer: id, user_id, question_id, text, html

If I do this call, then it will trigger the error:
- $db->question()->where('answer.user_id = ?', 1)->where('user_id = ?', 2);

The first where statement will be generated with the right table prefix, while the second where statement will be generated without any prefix and causes ambiguity.