Laravel 数据库去重计数

来源:互联网 发布:ios缓存清理软件 编辑:程序博客网 时间:2024/05/29 13:41

如果想查询一个表里某个字段排除重复的个数可以使用distinctcount进行查询

//查询去除id重复后的数量function getUserCount(){    return $this->distinct('id')->count('id');}
原创粉丝点击