如何像这样获得SQL:
select * from foo where LOWER(foo_name) like '%test%';
我知道我可以做到这一点:
select * from foo where LOWER(foo_name) = 'test';
签字人:
$where->addPredicate(new Predicate'Expression('LOWER(foo_name) = ?', 'test' ));
这个:
select * from foo where foo_name like '%test%';
签字人:
$where->addPredicate( new 'Zend'Db'Sql'Predicate'Like('LOWER(foo_name)', '%test%'));
但是如何将和结合起来呢?
@dave给出的答案很好。
即使是这样-
$where->expression("LOWER(title) LIKE ?", '%test%');
可能不理想,但您可以执行文字:
$where->literal("LOWER(foo_name) LIKE '%test%'");