如何使用Zend_Select
发出请求SELECT "subdivision" as `type`, a.id as id FROM `some_table` a;
这样做
$ this-> select ()
-> from (
array ('a' => 'some_table'), array ('type' => "subdivision", 'id' => 'a.id')
)
结果
SELECT `a`. `" Subdivision "` as `type`, a.id as id FROM `some_table` a;
答案 0 :(得分:4)
您必须标记静态值,以便Zend_Db_Select
不会使用Zend_Db_Expr
将该值作为标识符引用。
$this->select()
->from(array(
'a' => 'some_table'
), array(
'type' => new Zend_Db_Expr($db->quote('subdivision')),
'id' => 'a.id'
)
);