ThinkPHP – 数据库查询结果排序或者优先级限制

838次阅读
没有评论

Student::where('status', 1)
        ->where('age', '<>', 10)
        ->order('name', 'DESC')
        ->order('class')
        ->limit(2)
        ->select();

SQL语句:

SELECT * FROM `example` WHERE `status` = 1 AND `age` <> 10 ORDER BY `name` DESC,`class` LIMIT 2

正文完
 0
wujingquan
版权声明:本站原创文章,由 wujingquan 于2023-11-24发表,共计191字。
转载说明:Unless otherwise specified, all articles are published by cc-4.0 protocol. Please indicate the source of reprint.
评论(没有评论)