查询如何生成括号优先级

浏览:1341 发布日期:2016/08/17 分类:ThinkPHP5专区
$articleComment->where('aid', $id)->where('check', '1')->whereor('uid', 20)->order('id', 'desc')->limit(5)->select();

这样的代码生成

SELECT * FROM `fish_article_comment` WHERE `aid` = '9' AND `check` = '1' AND `uid` = 20 ORDER BY `id` desc LIMIT 5

这样的SQL语句。但是

我想生成的是

SELECT * FROM `fish_article_comment` WHERE `aid` = '9' AND (`check` = '1' OR`uid` = 20) ORDER BY `id` desc LIMIT 5

最佳答案
评论( 相关
后面还有条评论,点击查看>>