select field2,min(field1) as field1 into #a from tablename group by field1 delete from tablename
insert tablename(field1,field2) select field1,fiedl2 from #a
insert tablename(field1,field2) select field1,fiedl2 from #a
解决方案 »
- sql语句错误
- netbeans jdbc
- SQL server 2005,SQL server 2000 跨数据库访问问题?
- 请问怎样把SQL表 int类型的ID列(是标识递)在导出到ACCESS时,ID字段内容不变,数据类型变为自动编号。
- 请问下面这个表如何插入数据啊????
- --------帮老鼠MM问个问题----------
- 在asp中操作行转列的问题。把一个日程计划转换成按星期表述。
- 上次的一个sql问题不知怎样做.
- 关于SQL查询的结果里有重复数据的问题,望高手帮忙解决!!!!!!
- SQL SERVER 在什么地方加入SQL语句!
- 有关存储过程中出错列的问题???
- 高分求救,以后还可以再加。
from tablename a
where 字段1 <>(select min(字段1) from Tablename where 字段2=a.字段2)sql server
select min(a1) a1,a2 from caishui.test1 group by a2
在Access2000中通过。
送分来!!!
delete a
from tablename a
where 字段1 <>(select min(字段1) from Tablename where 字段2=a.字段2)
这样行吗?没试过
delete from tablename
where 字段1 not in
(select a.字段1 form
(select distinct top 100 字段2,字段1 from tablename order by 字段2)as a)
therefore, no sufficient information.
for example, which records of 字段1 should be reserved and which should be deleted?????