最新消息: USBMI致力于为网友们分享Windows、安卓、IOS等主流手机系统相关的资讯以及评测、同时提供相关教程、应用、软件下载等服务。

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

业界 admin 37浏览 0评论

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

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

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

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

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

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

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

select count(distinct(t.type)) as total from table t
发布评论

评论列表 (0)

  1. 暂无评论