Is there a way to make a table name dynamic in a query?

vooood

New Member
I am trying to create a Class-Inheritance design for products.There is the base table that contains all the common fields. Then for each product type there is a separate table containing the fields that are for that product type onlySo in order to get all the data for a product I need to \[code\]JOIN\[/code\] the base table with whatever table that correlates to the \[code\]product_type\[/code\] listed in the base table. Is there a way to make this query join on the table dynamically?Here is a query to try to illustrate what I am trying to do:\[code\]SELECT * FROM product_base bINNER JOIN <value of b.product_type> t ON b.product_base_id = t.product_base_id WHERE b.product_base_id = :base_id\[/code\]Is there a way to do this?
 
Back
Top