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
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