I am trying to achieve the following MySQL query in Zend Framework 1.11:
SELECT [other_columns], 1 AS dontShow FROM deal_merchants;
I am interested in selecting the number 1 and giving it the dontShow alias. However when I run the following code:
$select = $this->select(Zend_Db_Table::SELECT_WITHOUT_FROM_PART);
$select->setIntegrityCheck(false)
->from('deal_merchants',array('MIN(BidPrice) AS price','USERS_ID','MIN(BidQuotaFrom) AS MinFrom','MAX(BidQuotaTo) AS MaxTo','users.ImageURL','1 AS dontShow'));
I get the following exception:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'deal_merchants.1' in 'field list'
Figured out how to do it. Not sure if it’s the best way, but it works. Here is how, if someone stumbles over this: