ZKX's LAB

SQL数据库 怎么能 不显示 重复的字段 sql不显示重复数据

2021-04-23知识2

sql重复数据只显示一条 并且统计重复次数 你就没说明白select 字段,count(*)from 表名 group by 字段看看是这意思不?字段和表名自己替换下

sql server 不显示重复数据 distinct,使用这个2113关键字可以去5261重复,但是效率不是很高。4102select school_id from ft_user where batchcode='2013' group by school_id;建议这个样子1653试试,比用distinct要好。

求sql显示(查询)不重复数据命令 必须有唯一标识列才能过滤重复,下面给你个思路:生成唯一id列:select id=identity(1,1),bianhao、name、jiage、chandi、shuliang into#tmp_tb from 表1查询显示name不重复的所有数据:select*from#tmp_tb t1 where not exists(select 1 from#tmp_tb t2 where t2.name=t1.name and t2.id)bianhao列为唯一标示列,显示大的小的都可以那直接查就可以了:select*from kucun t1 where not exists(select 1 from kucun t2 where t2.name=t1.name and t2.bianhao)

随机阅读

qrcode
访问手机版