_common_query() and ambiguous 'id'

edited September 2011 in News & Announcements
Everytime i try to make use of the common_query method (simple left joins) all i get is a
Column 'id' in where clause is ambiguous
It's truly strange, i'm following the example on the user guide (of course on different tables - but the logic should be the same)...


  • edited 8:14AM
    Ambigous usually suggests that you are referencing a column that has the same name in two tables? Should it be table1.id and table2.id?
  • edited September 2011
    Yep, the problem is on the where() clause - but I can't seem to find out where i can modify the where condition to ask for table.id instead of just id ...
  • edited 8:14AM
    I remember having something similar a while back. I think I went through my code and blanket changed all references to the problematic column to [table].id . Not very clean, but it worked!

    Any further than that and I'm afraid I'm stumped too.

    What does your query look like? Might be useful to post the join query too.
  • edited 8:14AM
    I need to figure out where I can set the db->where() method to look for
    instead of
    Wait, does it have anything to do with the var public $filters?
  • edited September 2011
    You can just add the table name in your where statement as in your example above.
  • edited 8:14AM
    i tried adding a $this->db->where() in the _common_query() method but that produced errors actually... ?
  • edited 8:14AM
    What does the query look like if you run the debug_query() method on it (e.g. $this->my_model->debug_query());
Sign In or Register to comment.