PDA

View Full Version : how to delete the odd ids please???


crazy.works
09-27-2009, 10:01 PM
hello, i have database, in it lets say 50k row, i need to delete the rows with the odd ids... like "Delete From Table Where id (is odd)".
so how can i do that ? what is the mysql command for that please?
thanks

misheck
09-27-2009, 10:24 PM
try this

select * from tbl_name where userid%2=1

or

Try this on for size:SELECT <column> FROM <table> WHERE MOD(<row>,2) = 1;
That'll do odd rows, and to do even ones just make the mod = 0 instead of 1.

crazy.works
09-27-2009, 10:35 PM
thanks