You’d have to do this with a prepared statement. Something like:
SET @s = CONCAT('select * from ', @Cat, ' where ID = ', @ID_1);
PREPARE stmt1 FROM @s;
EXECUTE stmt1;
DEALLOCATE PREPARE stmt1;
More Related Contents:
- How can I simulate an array variable in MySQL?
- How to store Query Result in variable using mysql
- MySQL – Select from a list of numbers those without a counterpart in the id field of a table
- Syntax error due to using a reserved word as a table or column name in MySQL
- Change MySQL default character set to UTF-8 in my.cnf?
- MySQL update table based on another tables value
- MySQL offset infinite rows
- On Duplicate Key Update same as insert
- Ordering by the order of values in a SQL IN() clause
- LAST_INSERT_ID() MySQL
- SQL Selecting from two Tables with inner join and limit [duplicate]
- How to export and import a .sql file from command line with options? [duplicate]
- SQL: Repeat a result row multiple times, and number the rows
- Select the 3 most recent records where the values of one column are distinct
- What MySQL data type should be used for Latitude/Longitude with 8 decimal places?
- Setting up foreign keys in phpMyAdmin?
- How to get an age from a D.O.B field in MySQL?
- Mysql count instances of substring, then order by
- Importing a CSV to MySQL with different date format
- Using version control (Git) on a MySQL database
- mySQL – Create a New Table Using Data and Columns from Three Tables
- use a variable for table name in mysql sproc
- How to create dummy variable columns for thousands of categories in Google BigQuery?
- Most efficient way to store IP Address in MySQL [duplicate]
- What is the best way to do incremental backups in MySQL?
- Correct way to keep pooled connections alive (or time them out and get fresh ones) during longer inactivity for MySQL, Grails 2 app
- MySQL: Setting sql_mode permanently
- MySQL: how to index an “OR” clause
- Is it possible to count two columns in the same query
- mySQL regex in the where clause