Just learned how to use variables in mysql - the variables are bound to the specific client session - and are destroyed on disconnect.
SET @varname = value
SELECT max(value) from table into @varname
SELECT @varname
More documentation is available at http://dev.mysql.com/doc/refman/5.0/en/user-variables.html