0

How can I store my result set into the variable in MySql? I don't want to use temp Table.
In the SQL sever we have table variable but I think we don't have it in MySQl.

I need something like table variable or pseudo-code can be something like this

SET @tbl =(SELECT  Name,
                LastName
        FROM    MyTBL  
        WHERE   Id = 1);

SELECT Name FROM @tbl;

blue 77
  • 37
  • 9
  • They Suggested use temp table. I mentioned that I don't to use temp table – blue 77 Mar 18 '16 at 01:41
  • Sorry, it's just not possible. If you are only storing a single row, you can use multiple variables instead to store that data individually. However, if you want to store multiple columns and multiple rows in mysql, you have to use temp tables (even if you don't want to)... – sgeddes Mar 18 '16 at 01:47
  • Thank you @sgeddes I got my answer! – blue 77 Mar 18 '16 at 02:11

0 Answers0