我用sql查询出的重复数据,没有办法使用sql来屏蔽
结果如下
111 123
111 124
121 000
211 311
就是在clientdataset中删除一个比如111开头的
变成
111 123
121 124
211 311不是在表中删除,而是在clientdataset中删除
结果如下
111 123
111 124
121 000
211 311
就是在clientdataset中删除一个比如111开头的
变成
111 123
121 124
211 311不是在表中删除,而是在clientdataset中删除
解决方案 »
- 请问delphi中有没有求得当前日期是该年中的第多少个周的函数?
- 如何在代码中动态设置在打印机的服务器属性中自定义的纸张大小?
- 【····· 求职 ·····】〈Delphi软件开发〉
- 各位,组件Radiobox在那个面板中?
- 我现在有一个父窗口(mainwindow),和4个子窗口,子窗口名为,form1,form2,form3,form4,同时子窗口中都有一个涵数formok(str:string),现在
- udpsocket怎么用,在收到数据时,发送二进制数组对一些设备分配ip?
- 关于ActiveX的问题 请来帮帮忙吧
- 怎么才能在TreeView中按照一字符串变量找TreeNode,即字符串变量和TreeNode的Text相同
- 我的程序在运行后内存里就会多个东西!
- 如何检测程序是否存在内存泄露? 分数大大的!
- 【公告】delphi控制excel的疑问:当worksheet打印有多页时,如何在每页的前面加了我自己的标题头?(分不够再加)
- 怎样进行身份识别!!!!!!
如果有ID字段,就是具有唯一性的字段delect table where id not in ( select max(id) from table group by col1,col2,col3...
)
group by 子句后跟的字段就是你用来判断重复的条件,如只有col1,那么只要col1字段内容相同即表示记录相同。2,如果是判断所有字段也可以这样
select * into #aa from table group by id1,id2,....
delete table
insert into table
select * from #aa3,没有ID的情况select identity(int,1,1) as id,* into #temp from tabel
delect # where id not in (
select max(id) from # group by col1,col2,col3...)
delect table
inset into table(...)
select ..... from #temp
col1+','+col2+','...col5 联合主键
select * from table where col1+','+col2+','...col5 in ( select max(col1+','+col2+','...col5) from table
where having count(*)>1
group by col1,col2,col3,col4
)
group by 子句后跟的字段就是你用来判断重复的条件,如只有col1,那么只要col1字段内容相同即表示记录相同。2,
select identity(int,1,1) as id,* into #temp from tabel
select * from #temp where id in (
select max(id) from #emp where having count(*)>1 group by col1,col2,col3...)
111 124
121 000
211 311select ID,max(value) from Tablename group by ID这是在重复的ID内取出最大的,如果象去最小的,换成min就行了
剩下的对我有提示的就多散一些
谢谢大家了