8 messages in com.mysql.lists.win32RE: I don't understand
FromSent OnAttachments
John Richards17 Oct 2004 17:54 
Mike Hillyer17 Oct 2004 18:00 
John Richards17 Oct 2004 18:35 
Paul DuBois17 Oct 2004 19:49 
Danny Willis17 Oct 2004 23:19 
SGr...@unimin.com18 Oct 2004 07:25 
Danny Willis18 Oct 2004 10:02 
Danny Willis18 Oct 2004 11:42 
Subject:RE: I don't understand
From:Danny Willis (dann@project-wildfire.com)
Date:10/18/2004 10:02:12 AM
List:com.mysql.lists.win32

Oh! I didn't see that in the documentation. Guess I gotta read a little more. Thank you for assisting me in becoming more proficient with SQL and database methodology. I greatly appreciate it. I'm sure I'll have more questions for you soon. LoL.

Dan

-----Original Message----- From: SGr@unimin.com [mailto:SGr@unimin.com] Sent: Monday, October 18, 2004 10:26 AM To: Danny Willis Cc: win@lists.mysql.com Subject: Re: I don't understand

I believe it's a typo. Instead of :

SELECT penMemID, m_field_id_1, m_field_id_2, SUM (penIncident) AS totPoints

Use

SELECT penMemID, m_field_id_1, m_field_id_2, SUM(penIncident) AS totPoints

Try not to include spaces between your FUNCTION names and their parameter lists; use "SUM()" not "SUM ()". I would give you a link but the MySQL documentation site is being stubborn for me today.

"Danny Willis" <dann@project-wildfire.com> wrote on 10/18/2004 02:20:18 AM:

I have this query:

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 WHERE penRacID = 77 GROUP BY exp_members.member_id ORDER BY m_field_id_1

Running this query using phpmyadmin, I get results as expected. Now running the same exact query using my PHP DB classes, I get this error:

MySQL ERROR:

Error Number: 1064

Description: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(penIncident) AS totPoints FROM s_races_penalties LEFT JOIN exp

Query: 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 WHERE penRacID = 77 GROUP BY exp_members.member_id ORDER BY m_field_id_1

Why am I getting this error? I don't understand why it works in one but not in the other.

Thanks