任何一行都是第三行:-)
create table test(n int,name varchar(30));insert into test values(1,'yoko'),(1,'yoko'),(1,'yoko');select ROW_NUMBER() over(order by name) as ordinal, * from test;
删除“第三”行:-)
with a as(select ROW_NUMBER() over(order by name) as ordinal, * from test)delete from a where a.ordinal = 3
删除最后一行:
with a as(select ROW_NUMBER() over(order by name) as ordinal, * from test)delete from a where a.ordinal = (select MAX(ordinal) from a)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)