Bug #1354 | Sub-query returns incorrect result for count(*) | ||
---|---|---|---|
Submitted: | 19 Sep 2003 14:35 | Modified: | 1 Nov 2003 11:35 |
Reporter: | Kevin Oleniczak | Email Updates: | |
Status: | No Feedback | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | 4.1.0 | OS: | Windows (Windows XP) |
Assigned to: | CPU Architecture: | Any |
[19 Sep 2003 14:35]
Kevin Oleniczak
[20 Sep 2003 16:03]
Alexander Keremidarski
Can you please provide some example data as well as output of query you assume is wrong compared to expected output. With some random data inserted into your tables current 4.1 from source tree displays correct number of rows. It is not very related, but same result can be achieved without subquery: SELECT b.battle_rt_id, COUNT(bp.player_id) AS player_count FROM battles_rt AS b LEFT JOIN battle_players_rt AS bp ON b.battle_rt_id = bp.battle_rt_id GROUP BY b.battle_rt_id;
[1 Oct 2003 11:32]
Kevin Oleniczak
I appreciate the alternate approach but need the original query to work. I "think" it's fair to ask this as it is a very common method of doing sub-queries which 4.1 is supposed to provide. In the past week I actually have encountered a few other problems with sub-queries... using the same schema (plus another table or two) I tried this: select sum(deaths) deaths, sum(score) score, sum(frags) frags from ( select clan_id, bp.battle_rt_id, bp.player_id, max(deaths) deaths, max(score) score, max(frags) frags from clan_players cp, players p, battle_players_rt bp where cp.person_id = p.person_id and p.player_id = bp.player_id and bp.create_date > DATE_SUB(SYSDATE(),INTERVAL 30 DAY) and cp.clan_id =1 group by clan_id, bp.battle_rt_id, bp.player_id ) mysubquery this query will aggregate player scores for a some game stats I am experimenting with. It's neccessary to have the sub-query as I only want to sum the "last" set of values containing the max points achieved. When I run this query two things happen: -I get an error reported by windows xp that kills the mysql service -Returns the correct result This doesn't work for me either as I would have to restart mysql everytime someone runs this via a web app. Please help.
[1 Oct 2003 11:35]
Kevin Oleniczak
here's some of the error info reported by widowz... szAppName : mysqld-max-nt.exe szAppVer : 0.0.0.0 szModName : mysqld-max-nt.exe szModVer : 0.0.0.0 offset : 0006a583
[14 Feb 2005 22:54]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".