【发布时间】:2010-06-12 14:03:42
【问题描述】:
我正在尝试像这样通过 ORM 运行查询:
SELECT * from table where (fname like 'string%' or lname like 'string%')
AND (fname like 'string2%' or lname like 'string2%');
这是我目前所拥有的:
$results = ORM::factory('profiles');
foreach ($strings as $string) {
$result->where('fname', 'like', "$string%");
$result->or_where('lname', 'like', "$string%");
}
但这并没有考虑括号。有什么想法吗?
【问题讨论】:
-
如果您在 Kohana 2 中偶然发现了这个问题,请在此处查看我的回答:stackoverflow.com/a/56109498/3017716
标签: php orm kohana kohana-3 kohana-orm