10 messages in com.mysql.lists.win32RE: This doesn't make any sense to me...| From | Sent On | Attachments |
|---|---|---|
| Armando | 18 Oct 2004 17:25 | |
| Danny Willis | 18 Oct 2004 20:19 | |
| Danny Willis | 19 Oct 2004 07:25 | |
| SGr...@unimin.com | 19 Oct 2004 08:41 | |
| Danny Willis | 19 Oct 2004 09:11 | |
| SGr...@unimin.com | 19 Oct 2004 09:56 | |
| Danny Willis | 19 Oct 2004 10:01 | |
| SGr...@unimin.com | 19 Oct 2004 10:03 | |
| Danny Willis | 19 Oct 2004 13:45 | |
| Danny Willis | 19 Oct 2004 16:47 |
| Subject: | RE: This doesn't make any sense to me...![]() |
|---|---|
| From: | Danny Willis (dann...@project-wildfire.com) |
| Date: | 10/19/2004 07:25:01 AM |
| List: | com.mysql.lists.win32 |
Any takers? This problem has me totally hosed. I'm not even sure how to debug the sucker. If someone could at least point me in the right direction it would be greatly appreciated. Thanks!
I have the following two queries. Everything works fine with the exception of the SUM() statement. It seems that the sum is adding up ALL rows returned and dumping that information into all of the totPoints field for every row. Is this a bug? I've been reading the documentation provided here: http://dev.mysql.com/doc/mysql/en/GROUP-BY-Functions.html but it doesn't give me any information as to what is going on with my queries. Any ideas? This one has me stumped...
Query 1: SELECT penMemID, m_field_id_1, m_field_id_2, SUM(penIncident) AS totPoints FROM s_races_penalties LEFT JOIN exp_members ON exp_members.member_id = penMemID INNER JOIN exp_member_data ON exp_members.member_id = exp_member_data.member_id INNER JOIN s_races_results ON resRacID = penRacID WHERE penRacID = 80 AND penMemId = resMemID GROUP BY exp_members.member_id ORDER BY 1;
Query 2: SELECT exp_members.member_id, exp_member_data.m_field_id_1, exp_member_data.m_field_id_2, AVG( s_races_results.resStart ) AS avgStart, AVG( s_races_results.resFinish ) AS avgFinish, SUM( s_races_results.resLaps ) LapsCompleted, SUM( s_races_results.resLapsLed ) AS LapsLed, SUM( s_races_results.resNumIncidents ) AS numIncidents, AVG( s_races_results.resPoints ) AS AvgPoints FROM s_schedules LEFT JOIN s_races ON schID = racSchID INNER JOIN s_races_results ON resRacID = racID INNER JOIN s_races_penalties ON penRacID = racID INNER JOIN exp_members ON exp_members.member_id = resMemID INNER JOIN exp_member_data ON exp_member_data.member_id = exp_members.member_id WHERE TO_DAYS( schDateRun ) <732243 AND TO_DAYS( schDateRun ) >=732236 AND schSeaID =1 AND racActive =1 GROUP BY exp_members.member_id ORDER BY AvgPoints DESC;
-- MySQL Windows Mailing List For list archives: http://lists.mysql.com/win32 To unsubscribe: http://lists.mysql.com/win32?unsub=dann...@project-wildfire.com




