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
Post a Comment