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

php - Embed BBCode within itself not working -

three.js - how to load gltf in three JS -

sql server - T-SQL: Access DB objects in same schema without qualifying? -