thinkphp 去重求和统计数据sql

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
文章版权归作者所有,未经允许请勿转载。


共有 0 条评论