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 -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -