楼主第一条和第三条都是错的,
第一条应这样写:
delete t2 from aa t2 where col3 < (select max(col3) from aa
where col1 = t2.col1 and col2 = t2.col2)
or
delete t2 from aa t2 where exists(select 1 from aa
where col1 = t2.col1 and col2 = t2.col2 and col3>t2.col3)
第一条应这样写:
delete t2 from aa t2 where col3 < (select max(col3) from aa
where col1 = t2.col1 and col2 = t2.col2)
or
delete t2 from aa t2 where exists(select 1 from aa
where col1 = t2.col1 and col2 = t2.col2 and col3>t2.col3)
解决方案 »
- sqlserver2000支持下面的写法嘛
- 如何解决----警告: 聚合或其它SET 操作消除了空值.
- 邹大哥请帮帮忙,2005备份数据库
- case问题
- 排考号的问题:已有一个考号库testno,从基本信息库info_base取得编号,姓名,字段,根据成绩库mc的名次排序生成准考证号,没有成绩的作零
- 请教!!
- 那里有MS_SQL的教材的打包下载?doc格式
- sql2000 生成insert 语句
- 如何获得注册信息?
- 求一份linux下已编译好的ACE
- 讨论:如要对SQL Server服务器进行每日自动监控,应该监控哪些指标?
- 急问:为什么连接SQL SERVER2000之前一定要登陆一下服务器???
delete from aa where col3 < (select max(col3) from aa t2
where aa.col1 = t2.col1 and aa.col2 = t2.col2)各位没有做过这样的性能比较吗?
delete t1 from aa t1 left join (select max_col3 = max(col3) from aa group by col1,col2) t2 on t1.col3 = t2.max_col3
where t2.max_col3 is null
eager spool 和 lazy spool 有什么区别呢?
begin tran
delete aa
where exists
( select 1
from aa as tt
where aa.col1=tt.col1
and aa.col2=tt.col2
and aa.col3>tt.col3)
/*
delete from aa where col3 < (select max(col3) from aa t2
where aa.col1 = t2.col1 and aa.col2 = t2.col2)
*/
select * from aa
rollback tran