Assign query results to MySQL variable
- by 5un5
I'm querying a big mysql database with only read privileges, and I'd like to set some slow query results to a variable, 'foo', so I can use them again in other queries.
I get, ERROR 1193 (HY000): Unknown system variable '$foo'
when I enter:
set $foo := (select *
from table1 join table2
where bar = 0
group by id);
Is there a way to do this with variables, since I don't have privileges to create temporary tables?