[thelist] PHP & mySQL select error - whitespace issue?
Tom Dell'Aringa
pixelmech at yahoo.com
Fri Jun 11 13:16:40 CDT 2004
Hi folks,
I have a mySQL query that runs just fine within phpMyAdmin using the
query window. However, when I put it in my PHP code I get an error:
"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 '; insert into teamwins select teamAID, sum( case"
The code is below:
=================================================
delete from teamwins;
insert into teamwins select teamAID, sum(
case
when ( a1>b1 and a2>b2 )
or ( a1>b1 and a3>b3 )
or ( a2>b2 and a3>b3 )
then 1
else 0 end
)
from games
group by teamAID;
insert into teamwins select teamBID, sum(
case
when ( a1>b1 and a2>b2 )
or ( a1>b1 and a3>b3 )
or ( a2>b2 and a3>b3 )
then 0
else 1 end
)
from games
group by teamBID;
select teamID, sum(wins) as sumwins from teamwins
group by teamID
order by sumwins desc;
============================================
Seems to me this should work, no idea why it wouldn't. I'm using
HomeSite to edit the file. Any ideas?
Thanks
Tom
=====
http://www.Pixelmech.com/ - read my latest blog posting!
http://www.crossandthrone.com/ - Eternal Life
John 3:16
More information about the thelist
mailing list