Using session variables in queries
Starting with version 2.2 and above, MyWebSQL allows you to set and use session variables within your queries. Session variables are set using the standard MySQL SET command. The syntax and variable naming conventions are exactly the same as MySQL SET command, so you can use any valid MySQL SET combination in the query editor during the session.
For example, if you run the following command in your query window:
SET @table_name = 'some_table';
and run the query, your session variable will be set by the name of table_name. Now you can run queries like the following as long you do not logout of the session.
Please note that only the SET @… command can be used to set session variables. If you use the alternate query syntax to fetch result set data into variables, the behavior will not work and the variable will be lost by the time of next query. e.g. running the following command will not product the desired results:
SELECT name into @my_name from some_table;