MySQL——去重复

MySQL——去重复

把查询结果去除重复记录。注意:原表数据不会被修改,只是查询结果去重。使用的关键字为:distinct。

语法结构:select distinct 字段名 from 表名;

distinct不能以这种形式出现:select 字段名,distinct 字段名 from 表名;会报错。distinct只能出现在所有字段的最前方。

distinct出现在多个字段最前面,表示多个字段联合起来去重。

distinct可以使用分组函数。

posted on 2024-02-26 09:54  沁鱼  阅读(25)  评论(0)    收藏  举报