日期:2014-05-17  浏览次数:20871 次

高手进来呀。。。。。。。。。。
我找了几个库已经导入到我的数据库中了,但是因为那几个库中有些记录一样,导致我的库中有许多记录一样,请问该怎么办?
谁可以给我写个代码吗?/谢谢


我的思路是打开指定数据库,//循环,然后搜索,如果能找到,则删除当前指针所在的记录,//指针下移

这样对吗?
谁可以给我写出代码啊?我不知道具体指令



------解决方案--------------------
用这句试试吧:
select distinct * into newTableName from TableName
------解决方案--------------------
这个问题我最近也遇到过 我用的是本办法
将数据库中所有的表删除 然后重新导入
------解决方案--------------------
detele art where art表的主键 not in (select max(art表的主键) from art group by title)

------解决方案--------------------
在没有主键的情况下:
<%
SET objcon=server.createobject( "adodb.connection ")
objcon.open "driver={sql server};server=192.168.1.114;uid=sa;pwd=;database=pubs; "
'换成你的数据库连接
sql= "select 数据库的其它字段列表,distinct title * into newtable from art group by 数据库的其它字段列表,title "
objcon.execute sql
sql= "drop table art "
objcon.execute sql
sql= "select * into art from newtable "
objcon.execute sql
sql= "drop table newtable "
objcon.execute sql
%>
------解决方案--------------------
回复人:melodywithme() ( 三级(初级)) 信誉:100 2007-4-14 21:14:40 得分:0
?

insert into #temp select distinct * from tablename
delete from tablename
insert into tablename select * from #temp
drop table temp

在sql上操作更方便些吧


这个就可以啦。