thinkphp 去重求和统计数据sql

chat
chat

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)

THE END
分享
二维码
海报
thinkphp 去重求和统计数据sql
thinkphp5.1
<<上一篇
下一篇>>
chat