php大神 发表于 2023-5-17 18:27

mysql中distinct去除结果集中重复的数据

mysql中distinct去除结果集中重复的数据

sql语法代码:
mysql> select all stuaddress from stu;
+------------+
| stuaddress |
+------------+
| 北京         |
| 北京         |
| 天津         |
| 河南         |
| 河北          |
| 北京         |
+------------+
6 rows in set (0.00 sec)

-- 去除重复的项
mysql> select distinct stuaddress from stu;
+------------+
| stuaddress |
+------------+
| 北京         |
| 天津         |
| 河南         |
| 河北          |
+------------+
4 rows in set (0.00 sec)
页: [1]
查看完整版本: mysql中distinct去除结果集中重复的数据