PDA

View Full Version : MySQL Query Works on 1 MySQL server but not another


Caligatio
4-8-05, 01:36 AM
If someone can take a look at this and see why this query would work on Powweb's MySQL servers but not my own it would be much appreciated:

SELECT member.netid, member.fname, member.lname, status.excused, status.unexcused, status.pending, strikes.modstrikes FROM member LEFT JOIN ((SELECT netid, COUNT(CASE WHEN status = 'excused' THEN 1 ELSE NULL END) as excused, COUNT(CASE WHEN status = 'unexcused' THEN 1 ELSE NULL END) as unexcused, COUNT(CASE WHEN status = 'pending' THEN 1 ELSE NULL END) as pending FROM attendance GROUP BY netid) as status) ON member.netid = status.netid LEFT JOIN strikes ON status.netid=strikes.netid WHERE (member.status='active' OR member.status='neophyte') AND member.print='Y' ORDER BY member.lname

It spits out the error:

#1064 - 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 'as status) ON member.netid = status.netid LEFT JOIN strikes ON status.netid=stri' at line 1

tbonekkt
4-8-05, 09:28 AM
We're running MySQL 4.1.9 on our servers. What are you running? That would be the first thing I'd check.

Caligatio
4-8-05, 10:21 AM
I just installed MySQL 4.1.11

Keep in mind my machine is just a test bed for stuff before I upload it.