I am trying to create a select statement that uses the following structure:
$db
->select()
->from(
array('i' => ...),
array('provisional', 'itemID', 'orderID'))
->columns(array("'0' AS provisionalQty", "'ballast' AS productType"))
->joinLeft(
array('o' => ...),
'i.orderID = o.orderID', array())
->joinLeft(
array('f' => ...),
'i.productID = f.fixtureID AND f.supplierID = o.supplierID', array())
->joinLeft(
array('b' => ...),
'f.lampTechnology = b.lampTechnology ' .
' AND f.lampCount = b.lampCount ' .
' AND f.ballastVoltage = b.ballastVoltage ' .
' AND b.supplierID = o.supplierID')
->where('i.orderID = ?', $oObj->orderID, Zend_Db::INT_TYPE)
->where('!i.hidden AND i.productType = ? AND !i.provisional', 'fixture')
The equivalent in MySQL would look something like this (which works fine)...
SELECT '0' AS provisionalQty, 'ballast' AS productType, i.* FROM ... LEFT JOIN ... WHERE ...;
This, however, does not work as expected. The $db->columns() method expects there to be a table attached to each column even the 'pseudo'-columns. Any ideas?
-Chris