think-orm icon indicating copy to clipboard operation
think-orm copied to clipboard

find没条件查询的时候返回null吗

Open runphp opened this issue 4 months ago • 0 comments

比如我下面的代码

$this->where('1 = 1')->field(
            [
                'SUM(CASE WHEN point > 0 THEN point ELSE 0 END) AS positive_total',
                'SUM(CASE WHEN point < 0 THEN point ELSE 0 END) AS negative_total',
            ]
        )->find();//->select()->first();

如果不加where条件就会返回null,或者需要改用select查询

版本 v4.0.50

我记得 think-orm 3 不是这样哦,请问下是不是有问题

runphp avatar Sep 16 '25 04:09 runphp