[Zend] Selecting ambiguous column names
Posted: Sat Oct 23, 2010 1:49 pm
When working with the Zend_Db, does anyone know if there is a way to select ambigious column names between tables, without having to explicitely use alias or prioritize column selection.
I.e.,
SELECT *
FROM table1
INNER JOIN table2 ON table1.fkid =table2.pkid
If both columns had a "foobar", the latter table would be the one to return it's foobar column value. Preferably, what I would like to see is, when I pass it a wildcard, it would do some magic and auto expand to, lets say
SELECT table1.id, table1.foobar
table2.id, table2.foobar
...
and return the values grouped by their table.
Now I realize this is probably a design decision, however, having come from CakePHP, and this is how they do it, I would like to expand this functionality into ZF.
Any ideas?
I.e.,
SELECT *
FROM table1
INNER JOIN table2 ON table1.fkid =table2.pkid
If both columns had a "foobar", the latter table would be the one to return it's foobar column value. Preferably, what I would like to see is, when I pass it a wildcard, it would do some magic and auto expand to, lets say
SELECT table1.id, table1.foobar
table2.id, table2.foobar
...
and return the values grouped by their table.
Now I realize this is probably a design decision, however, having come from CakePHP, and this is how they do it, I would like to expand this functionality into ZF.
Any ideas?