mysql - Joining a table name based on joined field -


i have logs table store kinds of log information. table contains foreign_table_name , foreign_table_id columns.

when pulling in logs, verify foreign records still exists, want run "variable" join statement, e.g. this:

    select *        `logs` inner join `[logs.foreign_table_name]` on             `[logs.foreign_table_name].id` = `logs.foreign_table_id` 

how can dynamically "generate" these table names?


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -