How to delete X number of rows in mySQL
I have a table with three fields: name, password, textstr. This table has grown to about 4500 rows, and I need to delete the FIRST 3000 rows. (and leave the last, latest 1500 in the table).
I am using phpMyAdmin and want to know if there's a script/query I can write for this that will do this automatically instead of me having to manually click on 3000 Delete buttons!?!?!?!
Any help would be appreciated.
I am guessing you have used a KEY (maybe something like: ID), and if so, than just run the following command:
DELETE FROM table_name WHERE ID BETWEEN 1 AND 2999
You can do that from within phpMyAdmin
Last edited by AbelaJohnB; Nov 30, 2001 at 22:02.
Ok bad news --- I have no ID key assigned.
Any other way??? Can't I just POP out the first 1000 or something e..g like u can pop stuff from an array when programming?