sql server - Can I delete multiple of nth rows in a single query from a table in SQL? -


i want delete multiple of 4 table have thousands of record. how can it?

ex:- table1 1 2 b 3 c 4 d 5 e 6 f 7 g 8 h 9 

i want delete every 4th row.

i don't want use loop or cursor.

delete ( select *,row_number() over(order id) rn tablea ) rn%4=0 

sql fiddle link


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

php - Cannot override Laravel Spark authentication with own implementation -

What is happening when Matlab is starting a "parallel pool"? -