Select Mysql Table based on other table field value
The only way to "dynamically" use a tablename is via a Stored Routine in which you do CONCAT(...) to build the SQL, plus PREPARE and EXECUTE to then perform the constructed SQL.

Needing to do this is usually a sign of poor schema design.  Please explain the schema and why you went that direction; we may be able to help 'fix' it.