10 messages in com.mysql.lists.mysqlRE: Order on Delete?
FromSent OnAttachments
Ville Mattila17 Apr 2000 12:30 
sas...@mysql.com18 Apr 2000 07:52 
Thimble Smith18 Apr 2000 12:16 
Mark D Wolinski18 Apr 2000 13:30 
Mark D Wolinski19 Apr 2000 12:14 
Mark D Wolinski19 Apr 2000 12:49 
Thimble Smith19 Apr 2000 13:07 
Thimble Smith19 Apr 2000 13:20 
Mark D Wolinski19 Apr 2000 13:58 
sas...@mysql.com19 Apr 2000 14:14 
Subject:RE: Order on Delete?
From:Mark D Wolinski (ma@mrmark.com)
Date:04/19/2000 01:58:34 PM
List:com.mysql.lists.mysql

Hmm. Okay, Thanks.

Mark W

-----Original Message----- From: Thimble Smith [mailto:ti@mysql.com] Sent: Wednesday, April 19, 2000 4:21 PM To: Mark D Wolinski Cc: mySQL Subject: Re: Order on Delete?

On Wed, Apr 19, 2000 at 03:50:21PM -0400, Mark D Wolinski wrote:

How does one delete records in a specific order?

What I want to do is something like this: DELETE FROM table WHERE area=1 ORDER BY access DESC LIMIT 5;

Obviously, ORDER BY is illegal.

What's an alternative way to do this?

There isn't one. The LIMIT clause on DELETE is just a hack to make it possible for you to speed up applications in certain instances. It's not general, not standard, and using it in the above manner is wrong.

You should use the values of access (or some other field) to pick out which items should be deleted.

DELETE FROM table WHERE area=1 AND access BETWEEN x AND y;

Something like that.

To unsubscribe, send a message to: <mysql-unsubscribe-mark=mrma@lists.mysql.com>