Basically I need to do this query using Zend_Db_Select:
SELECT *, `matches`.`name` AS superName, `dimension`.`name` AS someName
FROM `matches`
JOIN `dimension` ON [whatever condition]
-- etc, etc.
Doing joins and the rest is easy eventually going to something like:
$select = Globals::db()->select();
$select -> from("matches")
-> join("dimension", "`matches`.`idDimension` = `dimension`.`idDimension`")
-> join("accounts", "`accounts`.idAccount = `matches`.idOwner");
// -> etc, etc
return Globals::db()->fetchAll($select);
The problem is that the column name appears in more than 1 table so name by itself is ambiguous therefore in response is null. How do I fix that?
I’ve tried:
$select = Globals::db()->select();
$select -> from("matches", "*, `matches`.`name`")
and
$select = Globals::db()->select();
$select -> from("matches", "*", "`matches`.`name`")
but both return error (column * not found and syntax error).
Try