0
点赞
收藏
分享

微信扫一扫

SQL语句去重关键词------- distinct

岛上码农 2022-09-14 阅读 157


在sql表中,可能会出现重复数据。有些时候我们希望仅仅列出不同(distinct)的值。关键词 distinct用于返回唯一不同的值

 

1.作用于单列

select distinct name from A

 

2.作用于多列

select distinct name, id from A

 

3.COUNT统计

select count(distinct name) from A; 

举报

相关推荐

0 条评论