MySQL Query involving column names containing math operators
- by devil_fingers
I'm a MySQL scrub, and I have asked around and checked around the internet for what I'm sure will turn out to be something obvious, but I'm very frustrated with what I thought would be a very, very simple query not working. So here goes. Please be gentle.
Basically, in a large database, some of the column names contain mathematical operators like "/" and "+." (Don't ask, it's not my database, I can't do anything about it). Here is the "essence" of my query (I took out the irrelevant stuff for the sake of this question):
SELECT PlayerId,
Season,
WPA/LI AS WPALI
FROM tht.stats_batting_master
WHERE Season = "2010"
AND teamid > 0
AND PA >= 502
GROUP BY playerid
ORDER BY WPALI DESC
When I run this, it returns "Unknown column 'LI' in 'field list'," I assume because it sees the "/" in WPA/LI as a division sign. Like I said, I'm sure this is easy enough to work around (it must be given how much this database is used), but I haven't' been able to figure out how.
Thanks in advance for any help.