select DISTINCT * from ... where ... // ^^^^^^^^^^
Distinct可以将重复的记录不显示 但是要INTO 到一个新表中去。
select field1,field2 into #lsb1 from table group by f1,f2 或 SELECT DISTINCT * INTO #LSB1 FROM TABLE
同意hj_cn(): 再加上: delete from table select * into table from #lsb1 不过是sql server中,还要注意备份
如果是ACCESS数据库: select DISTINCT * INTO NewTable [IN externaldatabase] from table [IN externaldatabase] where condition ; 如果是SQLSERVER数据库: 则: select distinct * into newtable from table where conditioin
// ^^^^^^^^^^
但是要INTO 到一个新表中去。
或
SELECT DISTINCT * INTO #LSB1 FROM TABLE
再加上:
delete from table
select * into table from #lsb1
不过是sql server中,还要注意备份
select DISTINCT * INTO NewTable [IN externaldatabase] from table [IN externaldatabase] where condition ;
如果是SQLSERVER数据库:
则:
select distinct * into newtable from table where conditioin