List:General Discussion« Previous MessageNext Message »
From:Brian Dunning Date:November 7 2005 6:51pm
Subject:Re: Delete all but the newest 100 records?
View as plain text  
On Nov 6, 2005, at 6:05 PM, Jeremy Cole wrote:

> DELETE FROM tbl ORDER BY ts DESC LIMIT 100, 999999;

That's exactly needed: I was not aware of the OFFSET option. So I  
tried this, which appears correct to me:

DELETE FROM table
WHERE field='somevalue'
ORDER BY timestamp DESC
LIMIT 100,99999999;

Also tried:

DELETE FROM table
WHERE field='somevalue'
ORDER BY timestamp DESC
LIMIT 99999999
OFFSET 100;

Either way I always get an error 1064, check the manual for the right  
syntax to use near '99999999'. This is MySQL 4.1.15. Tearing my hair  
out here. Any suggestion?
Thread
Delete all but the newest 100 records?Brian Dunning6 Nov
  • Re: Delete all but the newest 100 records?Jerry Swanson6 Nov
  • Re: Delete all but the newest 100 records?Bj√∂rn Persson6 Nov
  • Re: Delete all but the newest 100 records?Jeremy Cole7 Nov
    • Re: Delete all but the newest 100 records?Brian Dunning7 Nov
      • Re: Delete all but the newest 100 records?Jeremy Cole7 Nov
    • Re: Delete all but the newest 100 records?Brian Dunning7 Nov
Re: Delete all but the newest 100 records?Brian Dunning7 Nov
Re: Delete all but the newest 100 records?Brian Dunning8 Nov
  • Re: Delete all but the newest 100 records?Scott Noyes8 Nov
    • Deleting Duplicate RecordsRahul S. Johari8 Nov
Re: Delete all but the newest 100 records?Brian Dunning8 Nov
Re: Delete all but the newest 100 records?The Nice Spider8 Nov
Re: Deleting Duplicate RecordsRahul S. Johari8 Nov
Re: Deleting Duplicate RecordsRahul S. Johari8 Nov