| 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 Dunning | 6 Nov |
| • Re: Delete all but the newest 100 records? | Jerry Swanson | 6 Nov |
| • Re: Delete all but the newest 100 records? | Björn Persson | 6 Nov |
| • Re: Delete all but the newest 100 records? | Jeremy Cole | 7 Nov |
| • Re: Delete all but the newest 100 records? | Brian Dunning | 7 Nov |
| • Re: Delete all but the newest 100 records? | Jeremy Cole | 7 Nov |
| • Re: Delete all but the newest 100 records? | Brian Dunning | 7 Nov |
| • Re: Delete all but the newest 100 records? | Brian Dunning | 7 Nov |
| • Re: Delete all but the newest 100 records? | Brian Dunning | 8 Nov |
| • Re: Delete all but the newest 100 records? | Scott Noyes | 8 Nov |
| • Deleting Duplicate Records | Rahul S. Johari | 8 Nov |
| • Re: Delete all but the newest 100 records? | Brian Dunning | 8 Nov |
| • Re: Delete all but the newest 100 records? | The Nice Spider | 8 Nov |
| • Re: Deleting Duplicate Records | Rahul S. Johari | 8 Nov |
| • Re: Deleting Duplicate Records | Rahul S. Johari | 8 Nov |
