如何使用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;发布于 2011-08-08 19:35:40
您必须标记静态值,以便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'
)
);发布于 2021-11-02 13:47:40
这并不总是显而易见的,但对于Laminas来说,它看起来像这样
$select->from(['a' => 'some_table'])
->columns([
'id' => 'id',
'type' => new Laminas\Db\Sql\Expression('"subdivision"')
]);https://stackoverflow.com/questions/6981442
复制相似问题