3 messages in com.mysql.lists.bugsProblem with LIMIT and a DATE| From | Sent On | Attachments |
|---|---|---|
| Sam Phillips | 10 Mar 2003 17:01 | |
| Paul DuBois | 10 Mar 2003 17:58 | |
| Alexander Keremidarski | 10 Mar 2003 18:10 |
| Subject: | Problem with LIMIT and a DATE![]() |
|---|---|
| From: | Sam Phillips (samb...@mac.com) |
| Date: | 03/10/2003 05:01:46 PM |
| List: | com.mysql.lists.bugs |
Using a limit with a repeated date produces seemingly random results. I have to order on "date desc, id desc" to get a consistent order. Is this expected behaviour? Am I missing something obvious?
Sam Phillips samb...@mac.com UK
How-To-Repeat:
mysql> select id, date -> from news -> order by date desc -> ; +----+------------+ | id | date | +----+------------+ | 7 | 2003-03-08 | | 8 | 2003-02-04 | | 2 | 2003-01-18 | | 3 | 2003-01-18 | | 4 | 2003-01-18 | | 5 | 2003-01-18 | | 6 | 2003-01-18 | +----+------------+ 7 rows in set (0.01 sec)
mysql> select id, date -> from news -> order by date desc -> limit 0,5; +----+------------+ | id | date | +----+------------+ | 7 | 2003-03-08 | | 8 | 2003-02-04 | | 6 | 2003-01-18 | | 5 | 2003-01-18 | | 4 | 2003-01-18 | +----+------------+ 5 rows in set (0.02 sec)
mysql> select id, date -> from news -> order by date desc -> limit 5,5; +----+------------+ | id | date | +----+------------+ | 5 | 2003-01-18 | | 6 | 2003-01-18 | +----+------------+ 2 rows in set (0.02 sec)




