Created
November 2, 2016 20:57
-
-
Save KIVagant/e143ac569a0cb2984d528495d2fcf6b0 to your computer and use it in GitHub Desktop.
Mysql variable in subselect problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT @a := test, | |
(SELECT @a) AS first_level_subquery, | |
(SELECT * FROM (SELECT @a) as tmp ) AS second_level_subquery | |
FROM ( | |
SELECT 1 as test UNION ALL SELECT 2 UNION ALL SELECT 3 | |
) AS some_data\G | |
+------------+----------------------+-----------------------+ | |
| @a := test | first_level_subquery | second_level_subquery | | |
+------------+----------------------+-----------------------+ | |
| 1 | 1 | NULL | | |
| 2 | 2 | NULL | | |
| 3 | 3 | NULL | | |
+------------+----------------------+-----------------------+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment