Closed dark-walk closed 4 years ago
invoke里面操作count
$xxx->where([ 'tid' => $id, 'day' => date('Ymd') ])->count();
返回结果为
array(1) { [0]=> array(1) { ["count(`*`)"]=> int(123) } }
不能直接返回一个结果值,如123吗 2.invoke里面使用count,
$xxx->where([ 'tid' => $id, 'day' => date('Ymd') ])->count('id as count');
在count(里面 as) 整个SQL就不会执行了
DbManager::getInstance()->invoke(function ($client){ return Test::invoke($client)->count(); });
测试正常,需要自定义别名使用field + all方法完成。
invoke里面操作count
返回结果为
不能直接返回一个结果值,如123吗 2.invoke里面使用count,
在count(里面 as) 整个SQL就不会执行了