I would like to delete the first 100 rows or the last 100 rows in a certain table (ordered by the primary key).
Note: Lots of data is being spooled into this table.<
SET @first = 1; delete from mytable where primKey in (select 1 from myTable order by CASE WHEN @first = 1 THEN primKey END ASC, CASE WHEN @first <> 1 THEN primKey END DESC limit 100)