tags:

views:

80

answers:

2

i have a huge access table containing about 400000 rows . what sql query can i give to delete every alternate row in the table. ?

I do have a column in the table which has values from 1 , 2, 3 ,4 .... about 400000 .

+2  A: 

Try using Mod. Something like

DELETE Table1.*
FROM Table1
WHERE ((([ID] Mod 2)=0));
astander
Access sticks in those parentheses, but it does not need them.
Remou
.. in this case.
Remou
A: 

Assuming your table's name is "table", and your column with the line number is named "id", it would be

DELETE FROM table WHERE MOD(id,2)=0

Edit: Apparently, this is the wrong Syntax for MS Access. Use astanders solution below.

Jens
I do not see why this is the accepted answer when the syntax is wrong.
Remou
I just noticed the "ms-access" tag. I think my answer is correct for MySql...
Jens
That's true, but it is still the wrong answer here :)
Remou
yes i had given it as right answer earlier because i tried on mysql and it did worked good.
silverkid