您当前的位置: 首页 >  php
  • 0浏览

    0关注

    1477博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

thinkphp count distinct

软件工程小施同学 发布时间:2019-08-27 17:51:52 ,浏览量:0

 在计数的时候,如果想要排除某个字段重复的记录,应该用
$total = $User->where($where)->count('distinct id');
而不是
$total = $User->distinct(true)->where($where)->field('id')->count();

因为可能在连表查询时,失效

 

关注
打赏
1665320866
查看更多评论
立即登录/注册

微信扫码登录

0.0411s