sql怎么去掉重复记录,怎么去掉重复字段

来源:互联网 发布:数组的逻辑与运算 编辑:程序博客网 时间:2024/04/30 09:11
 

select distinct 字段1,字段2 from table1 where...

这样查询table1中字段1,字段2不重复的记录,注意的是distinct只能放在所有字段的最前面,不能

select 字段1,distinct 字段2 from talbe1 where...。

但如果是

select distinct * from table1 where...

这样只有有一个字段不同,就会分不同行的记录显示。

原创粉丝点击