From: "Ashley M. Kirchner"

> Jigal van Hemert wrote:
>
> >You can cheat a bit and use a UNION of one SELECT:
> >
> >(SELECT field1,field2,field3 FROM table ORDER BY field3 ASC LIMIT 2)
ORDER
> >BY field3 DESC;
> >
>     This didn't work as expected.

Very odd!

These are my results on MySQL 4.0.21 using InnoDB tables (it was suitable
data for this test, InnoDB was used for other reasons):

SELECT  `msg_id` ,  `from_accountid` ,  `sent`
FROM  `msg_content`
ORDER  BY  `sent`  DESC
LIMIT 5

msg_id  from_accountid  sent
48469   30328           2004-11-24 03:14:49
48468   16788           2004-11-24 03:06:47
48467   22935           2004-11-24 02:49:49
48466   18115           2004-11-24 02:46:45
48465   27356           2004-11-24 02:29:23

(SELECT  `msg_id` ,  `from_accountid` ,  `sent`
FROM  `msg_content`
ORDER  BY  `sent`  DESC
LIMIT 5 ) ORDER BY `sent` ASC

msg_id  from_accountid  sent
48465   27356           2004-11-24 02:29:23
48466   18115           2004-11-24 02:46:45
48467   22935           2004-11-24 02:49:49
48468   16788           2004-11-24 03:06:47
48469   30328           2004-11-24 03:14:49

This works exactly as expected....

Regards, Jigal.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to