I'm trying to figure out how to get the lowest record for a specific user for each column and in the same query get a total of those numbers...
The first part I have figured out, but adding the total I can't seem to work...
Here is what I have done:
$sql = "SELECT (@st1:=COALESCE(MIN(stroke1),0)) AS st1,
(@st2:=COALESCE(MIN(stroke2),0)) AS st2,
(@st3:=COALESCE(MIN(stroke3),0)) AS st3,
(@st1+@st2+@st3) AS st_total
FROM ".$prefix."_stroke WHERE user = $user
GROUP BY user";
st1, st2, st3 comes out as they should, but the st_total comes out with nothing... Please help!