How can i specify Zend Db Table Select
to fetch a dummy column.
i want to generate sql like this
SELECT 'ABC' AS xyz , name FROM employee
Edit:
I have tried this
$select->from('employee',array(
'xyz'=>'ABC',
'name'
));
and also as
$select->from('employee',"'ABC' AS xyz , name"));
in both cases Zend intelligently considers 'ABC' as a field in schema. so it generate something like
SELECT `employee`.`'ABC'` AS `xyz` , `name` FROM `employee`
which produces error as ABC is not a field of employee
You should try
$select->from ('employee', array (new Zend_Db_Expr ('"ABC" AS title'), 'name'));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With