我正在使用zend而且我被困在创建别名的地方条件:
示例代码:
$select = $db->select()
->from(array('p' => 'products'), 'p.product_id')
->columns('product_name', 'p')
->where('p = ?', 'value');
// Alternatively use columns('p.product_name')
修订代码
$select = $db->select()
->from(array('p' => 'products'), 'p.product_id')
->columns(array('x' => new Zend_Db_Expr('(SELECT...)'
)))
->where('x = ?', 'value');
// Alternatively use columns('p.product_name')
我为x
创建一个条件这会产生错误。谁能告诉我我错过了什么?
答案 0 :(得分:1)
您的格式似乎有误。
我认为在你的情况下它应该如下,
$select = $db->select()
->from(array('p' => 'products'))
->columns('product_name')
->where('p.id = ?', 'value');