distinct 使用方法 高手接分 count(distinct date,name,id) 查出的结果是不是date name id 并集取得的唯一值???即distinct 是否同时作用在date,name,id上???如果不是该如何让distinct作用在三者身上??? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 count(distinct date,name,id) 多个列值同时组合成的唯一性 distinct date,name,id:是三个字段的唯一count(distinct concat(date,name,id)) 一楼答错了。应该是。是三个结果的综合唯一。mysql> select * from t_dawenwen1128;+-------+--------+---------+| c_id | c_name | c_namef |+-------+--------+---------+| 10001 | 沙 | 10.12 || 10001 | 石 | 10.12 || 10001 | 煤 | 10.12 || 10002 | 沙 | 10.12 || 10002 | 水 | 10.12 || 10002 | 盐 | 10.12 |+-------+--------+---------+6 rows in set (0.00 sec)mysql> select count(distinct c_id,c_namef) -> from t_dawenwen1128;+------------------------------+| count(distinct c_id,c_namef) |+------------------------------+| 2 |+------------------------------+1 row in set (0.00 sec)mysql> count(distinct concat(date,name,id)) 这句是什么意思?? 示例:mysql> select * from tb_1a;+------+------+------+| date | name | id |+------+------+------+| 1 | 2 | 1 | | 1 | 3 | 2 | | 1 | 3 | 2 | | 1 | 3 | 3 | | 2 | 4 | 5 | +------+------+------+5 rows in set (0.00 sec)mysql> select count(distinct date,name,id) from tb_1a;+------------------------------+| count(distinct date,name,id) |+------------------------------+| 4 | +------------------------------+1 row in set (0.02 sec)mysql> 即将三个字段结合为一个结果,再对此结果distinct mysql> select count(distinct c_id,c_name,c_namef) -> from t_dawenwen1128;+-------------------------------------+| count(distinct c_id,c_name,c_namef) |+-------------------------------------+| 6 |+-------------------------------------+1 row in set (0.00 sec)mysql> sql 查询日期问题 Vista 安装 mysql-connector-odbc-3.51.12-win32 失败 MySQL 多个连接查询问题 定义载入时间 mysql and or ? 请问怎么把别人的数据库导入到MYSQL里面? 使用命令行连接出错,请教各位了 新人问题,望大神帮助。mysql复制的问题。 mysql中in_array问题 MySQL嵌套查询(百万级数据),急~ 怎么将MySQL中很多类似的表统一到一个表中 关于mysql的in 查询
count(distinct concat(date,name,id))
一楼答错了。应该是。是三个结果的综合唯一。mysql> select * from t_dawenwen1128;
+-------+--------+---------+
| c_id | c_name | c_namef |
+-------+--------+---------+
| 10001 | 沙 | 10.12 |
| 10001 | 石 | 10.12 |
| 10001 | 煤 | 10.12 |
| 10002 | 沙 | 10.12 |
| 10002 | 水 | 10.12 |
| 10002 | 盐 | 10.12 |
+-------+--------+---------+
6 rows in set (0.00 sec)mysql> select count(distinct c_id,c_namef)
-> from t_dawenwen1128;
+------------------------------+
| count(distinct c_id,c_namef) |
+------------------------------+
| 2 |
+------------------------------+
1 row in set (0.00 sec)mysql>
count(distinct concat(date,name,id)) 这句是什么意思??
+------+------+------+
| date | name | id |
+------+------+------+
| 1 | 2 | 1 |
| 1 | 3 | 2 |
| 1 | 3 | 2 |
| 1 | 3 | 3 |
| 2 | 4 | 5 |
+------+------+------+
5 rows in set (0.00 sec)mysql> select count(distinct date,name,id) from tb_1a;
+------------------------------+
| count(distinct date,name,id) |
+------------------------------+
| 4 |
+------------------------------+
1 row in set (0.02 sec)mysql>
-> from t_dawenwen1128;
+-------------------------------------+
| count(distinct c_id,c_name,c_namef) |
+-------------------------------------+
| 6 |
+-------------------------------------+
1 row in set (0.00 sec)mysql>