什么意思,你看懂我的语句是什么意思了么。如果没看懂就不要乱用我的语句,把数据删了到时找不回来可别找我。。。[Quote=引用 2 楼 的回复:]
这个 r 恒为1
引用 1 楼 的回复:
SQL code
create table temp as select c1,c2 from (select c1,c2,row_number() over (partition by c1 order by c2) r from a) where r<=200;
drop table from a;
rename temp t……
[/Quote]
create table temp as select c1,c2 from (select c1,c2,row_number() over (partition by c1 order by c2) r from a) where r<=200;
drop table from a;
rename temp to a;
create table temp as select c1,c2 from (select c1,c2,row_number() over (partition by c1 order by c2) r from a) where r<=200;
drop table from a;
rename temp to a;
create table temp as select c1,c2 from (select c1,c2,row_number() over (partition by c1 order by c2) r from a) where r<=200;
drop table from a;
rename temp to a;
一条语句的话。。
delete from a
where rowid in
(select rowid, row_number() over(partition by c1 order by c2) r
from a)
where r > 200;
关键是这行这种用法我不会么
row_number() over (partition by c1 order by c2) r
看样子是
partition by c1 :按C1分组
order by c2 :按C2排序
row_number() over (partition by c1 order by c2) r 是取这个需要