Monday, 18 September 2017

Delete either first set of rows or last set rows in MYSQL in dynamic fashion

DELETE FROM table <condition> ORDER BY the field DESC|ASC limit 100
 
for first 100,
DELETE FROM table <condition if required> ORDER BY <field> ASC limit 100
 
and for last 100,
DELETE FROM table <condition if required> ORDER BY <field> DESC limit 100
 
 
 

No comments:

Post a Comment