记录相同指的是a,b 都相同?select a,max(b) into #tmp from table1 group by a
truncate table table1
insert into table1 select * from #tmp
truncate table table1
insert into table1 select * from #tmp
解决方案 »
- 事件查看器
- sql server 2005 pivot 行列倒置请教
- 生成表新纪录 adapter.Update(dt) 和 insert 语句 哪个性能高
- 再请教一个触发器的问题 关于日期判断的
- 高并发优化Sql代码
- 请教一个疑难问题
- 邹建,用drop删除的表怎么还原!
- 比如一张银行卡, 卡号是 9888 1755 1000 1001 怎么设计表! 谢谢
- 求一条SQL语句(先谢过)!
- 小小问题!!!come in
- 每次人多,读数据库次数增多的时候,sql数据库就占用cpu100%,有什么办法当某个连接读取数据库占用cpu达到50的时候就把该连接断掉吗??
- 怎样得知一个数据库中哪些表有触发器?
select distinct * from table1就可以了
lsh zp
1 (大小不固定的)
1
2
2
3
3
3怎么样删除一个1,一个2 二个3 (假设有很多相同的记录)
a b c
1 2 1.02 --重复 随机器取其中一条数据
2 3 3.3
3 4 5
1 2 1.05 --重复
4 5 6 select a,b
,(select top 1 c from T3 where a = d.a and b = d.b order by newid()) as c
from T3 d
group by a,b --a,b 组合分组结果:
1 2 1.05
2 3 3.3
3 4 5
4 5 6
比例表jb_tab
lsh zp
1 (大小不固定的)
1
2
2
3
3
3怎么样删除一个1,一个2 二个3 (假设有很多相同的记录)
select identity(int) as newidd,* into #t from jb_tabtruncate table jb_tabinsert into jb_tab
select lsh,zp from #t a
where not exists (select 1 from #t where lsh=a.lsh and newidd>a.newidd)