如何使用 Zend_Select 发出请求
SELECT "subdivision" as `type`, a.id as id FROM `some_table` a;
Run Code Online (Sandbox Code Playgroud)
这样做
$ this-> select ()
-> from (
array ('a' => 'some_table'), array ('type' => "subdivision", 'id' => 'a.id')
)
Run Code Online (Sandbox Code Playgroud)
结果
SELECT `a`. `" Subdivision "` as `type`, a.id as id FROM `some_table` a;
Run Code Online (Sandbox Code Playgroud)
您必须标记静态值,以便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'
)
);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
676 次 |
| 最近记录: |