I haven't executed this script yet, but I wanted to know whether or not I could execute a JOIN query, using a column's result as the table name for that query. It sounds really recursive, but I believe it should be possible.
Example:
PHP Code:
$q_relate = "SELECT * FROM attr_relationships ar JOIN ar.attr_table rr ON ar.attr_id = rr.id WHERE ar.parent_table='".$parent_table."' AND ar.parent_id='".$parent_id."'";
Please advise if my syntax is incorrect, or if my approach to this is impossible.
I can always run a second query with the results of a select query, but that doesn't seem as elegant to me.
|