SQL筛选不重复数据的案例 delet from 表名where PRP_Numbernot int(select PRP_Number,count(*)from 表名where gourp by PRP_Numberhaving count(*)>;1)andPRP_Number not in(select PRP_Number from 表名 whereconvaert(int,PRP_Number)convert(int,substring(select PRP_Number from 表名 where PRP_Number like这里写你不要删除重复的P0002-P0003之间的第一个P0002,如下'?P0002')0,charindex('_'))andconvaert(int,PRP_Number)>;convert(int,substring(select PRP_Number from 表名 where PRP_Number like这里写你不要删除重复的P0002-P0003之间的最后的P0003,如下'?P0003')0,charindex('_'))P0001-P0002我就不写了,你按照上面的思路你自己套用吧慎用,请看清再执行
SQLServer 筛选出时间最新的且不重复的数据 select*from(select*,num=ROW_NUMBER()over(partition by FK_Code order by RecTime desc)from trace_reports.dbo.package_code_recs10)Twhere num=1你试试这个
SQL重复数据的筛选 insert into 临时表(ID,BH,SJ,PZ)select ID,BH,SJ,PZfrom JKXX这样查询出来的值会有重复数据,JCSJ是检查时间,怎么将重复数据只留F_JCSJ最新的那一行啊。