toasty,
Sunday, October 27, 2002, 11:17:53 PM, you wrote:
taddc> Under some pretty specific conditions, adding a "LIMIT" clause to a query
taddc> will cause incorrect results.
taddc> How-To-Repeat:
taddc> This bug is NOT present in 4.0.3.
taddc> CREATE TABLE `history` (
taddc> `id_pic` int(11) unsigned NOT NULL auto_increment,
taddc> `id_cam` smallint(11) unsigned NOT NULL default '0',
taddc> `time` int(14) unsigned NOT NULL default '0',
taddc> `votes` smallint(3) NOT NULL default '0',
taddc> `score` mediumint(3) NOT NULL default '0',
taddc> `avgscore` double NOT NULL default '-65534',
taddc> `id_show` smallint(11) NOT NULL default '0',
taddc> `views` mediumint(8) unsigned NOT NULL default '0',
taddc> PRIMARY KEY (`id_pic`),
taddc> KEY `avgscore` (`avgscore`),
taddc> KEY `id_cam` (`id_cam`),
taddc> KEY `id_show` (`id_show`),
taddc> KEY `votes` (`votes`),
taddc> KEY `camshow` (`id_cam`,`id_show`)
taddc> ) TYPE=MyISAM
taddc> CREATE TABLE `cam_update` (
taddc> `id_cam` int(11) NOT NULL auto_increment,
taddc> `status` tinyint(4) NOT NULL default '0',
taddc> PRIMARY KEY (`id_cam`),
taddc> KEY `status` (`status`)
taddc> ) TYPE=MyISAM PACK_KEYS=1
taddc> mysql> SELECT history.* FROM history LEFT JOIN cam_update ON
history.id_cam=cam_update.id_cam WHERE history.votes > 10 AND (cam_update.status=2)
ORDER BY avgscore desc limit 0,13;
taddc> Empty set (0.14 sec)
taddc> mysql> SELECT history.* FROM history LEFT JOIN cam_update ON
history.id_cam=cam_update.id_cam WHERE history.votes > 10 AND (cam_update.status=2)
ORDER BY avgscore limit 0,13;
taddc>
+--------+--------+------------+-------+-------+--------------------+---------+-------+
taddc> | id_pic | id_cam | time | votes | score | avgscore | id_show |
views |
taddc>
+--------+--------+------------+-------+-------+--------------------+---------+-------+
taddc> | 388402 | 520 | 1017892232 | 31 | -65 | -0.185185185185185 | 0 |
0 |
taddc>
+--------+--------+------------+-------+-------+--------------------+---------+-------+
taddc> 1 row in set (0.15 sec)
Could you please give me some data for testing? I couldn't repeat it
with my test data :(
--
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Victoria Reznichenko
/ /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED]
/_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net
<___/ www.mysql.com
---------------------------------------------------------------------
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