您当前的位置: 首页 >  sql

杨林伟

暂无认证

  • 3浏览

    0关注

    3337博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

解决MySQL count统计数目错误的问题

杨林伟 发布时间:2020-11-06 09:30:54 ,浏览量:3

一般我们写count语句,SQL如下:

select count(t.type) as total from table t 

如果出现统计条目数多了的情况下,可以联合distinct来写,修改后如下:

select count(distinct(t.type)) as total from table t
关注
打赏
1662376985
查看更多评论
立即登录/注册

微信扫码登录

0.0788s