I have three user defined variables, and have only figured out how to concatenate at most, two at a time by performing the following query.
SET @sql := (CONCAT(@sql_q1, ' UNION ', @sql_med));
I also want to concatenate my other user-defined variable, @sql_q3, Such that @sql stores @sql_q1, @sql_med and @sql_q3.
Is there a way in which I can concatenate three user defined variables similar to above?
All three variables use the same data from the same table. So joining them isn't an issue, as I can mix and match two variables at a time by using my union line above.
Thank you for your help!
SET @`sql_q1` := 'SELECT 58', @`sql_med` := 'SELECT 116', @`sql_q3` := 'SELECT 172'; SET @`sql` := (CONCAT(@`sql_q1`, ' `quartile` UNION ', @`sql_med`, ' UNION ', @`sql_q3`));