KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
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. Basically, I want to have a variable for a cumbersome subquery, so I can reuse it without having the cost of running it every time I want to use it. when I enter: set @foo := (select * from table1 join table2 where bar = 0 group by id); I get: ERROR 1241 (21000): Operand should contain 1 column(s) and if I restrict to 1 column, ERROR 1242 (21000): Subquery returns more than 1 row Is there a way to store an array or a table in a variable? I don't have privileges to create temporary tables.
Tags (comma-separated)
Save Edits
Cancel