While I have no solution for you, I am curious: why would you need to
specify the order rows are deleted in?

Mike


-----Original Message-----
From: Peter M. Flor [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 19, 2002 4:03 PM
To: [EMAIL PROTECTED]
Subject: MySQL 2.23 DELETE ORDER BY bug


I have been beating my head against a wall to try and get this to work.
Apparently in version 2.22 a bug preventing ORDER BY in a SELECT statement
from working was fixed in 2.23. Well I think that this bug also exists in
2.23 when using ORDER BY in conjunction with a DELETE statement, and
possibly others.

My code yields an SQL syntax error "near" the order by statement:

DELETE FROM sessions WHERE userid=someuser ORDER BY sessionid DESC LIMIT
somenumber;

I'm using php, here is the actual code as it is written in my script:

mysql_query( "DELETE * FROM sessions WHERE userid=$userid ORDER BY sessionid
DESC LIMIT $numrows" );

During my research i found an example of code at
http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#DEL
ETE with an example of code that in function resembles my code almost
exactly. Here is the code from that page:

DELETE FROM somelog
WHERE user = 'jcole'
ORDER BY timestamp
LIMIT 1;

However this doesn't work either. There's absolutely nothing i've been able
to do. Please email me with any followups to this bug, and any action taken.
Thanks so much for your time.


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to