去除重复值 如果有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...)
TO:楼上的..我用了..delect info where id not in (select max(id) from info group by id) 提示'where' 附近有语法错误。 表info..的id为numeric类型..还有text类型的content字段 比如 id,content 1 23,中华人民共和国 2 24,国 3 23,中华人民共和国 4 24,国 这种该怎么删除重复的记录啊.
delete info where id not in (select max(id) from info group by cast(content as varchar(8000)))
insert 表2 (字段1,字段2,字段3) Select 字段3,cast(字段5 as int),字段8 from 表1
右健数据库,所有任务,到处数据,
在“选择源表和视图”步,点击哪个灰色的转换按钮,然后点击转换页
选择“在将信息复制到目的时对其进行转换”里面可以鞋vbscript对转换进行详细控制
dts很强大的!
Select 服务器.数据库.dbo.字段4,字段5,字段6 from 表2
Insert into 服务器.数据库.dbo.表1 (字段1,字段2,字段3)
Select 字段4,字段5,字段6 from 服务器.数据库.dbo.表2
这应该就可以了
如果有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...)
提示'where' 附近有语法错误。
表info..的id为numeric类型..还有text类型的content字段
比如
id,content
1 23,中华人民共和国
2 24,国
3 23,中华人民共和国
4 24,国
这种该怎么删除重复的记录啊.
from 表1