thinkphp 去重求和统计数据sql
![chat](https://cdn.crazyming.com/pic/2023/11/655356fd0a5bb.png)
LoginLog::where('logout_time', null)
->count('DISTINCT user_id');
解析后的sql:
SELECT COUNT(DISTINCT user_id
) AS tp_count FROM login_log
WHERE logout_time
IS NULL
(tp5.1)
版权声明:
作者:东明兄
链接:https://blog.crazyming.com/note/915/
来源:CrazyMing
文章版权归作者所有,未经允许请勿转载。
![](https://blog.crazyming.com/wp-content/uploads/2023/05/logonew.png)
![chat](https://pic.crazyming.com/i/pic/2023/08/64effaeea7b57.png)
共有 0 条评论