Okay, I'm still learning this PHP/MySQL game, but I'm trying to learn. I'm wanting to know how it's possible to SUM 5 columns and then SUM those within the same query within MySQL. Is it even possible?
SELECT recruitid, fname, lname, SUM(200-rivals100) AS ptsrivals, SUM(200-scout100) AS ptsscout, SUM(200-espn) AS ptsespn, SUM(200-cstv) AS ptscstv, SUM(200-rise) AS ptsrise, SUM(ptsrivals+ptsscout+ptsespn+ptscstv+ptsrise) AS totalpts
FROM recruit
WHERE class =2008
GROUP BY recruitid
ORDER BY totalpts
When I run this, I get ptsrivals is an unknown field which makes sense since it technically isn't a field within the recruit table, but how do I call it since I just created it in the query?