MySQL 4.1.13a-nt.
I have a few tables set up in my database. The main of which is called products
which stores information about each product, including their product identification number (pid
) and their product type (type
, in this case, ‘shower’ or ‘boiler’).
I have 2 other tables named products_showers
and products_boilers
which store tech specs of each product, depending on whether that product is a shower/boiler.
Here’s a theoretical statement of what I’m trying to achieve (but it generates errors)
mysql> SELECT
-> *
-> FROM
-> products,
-> CONCAT("products_",products.type,"s") as products_tech
-> WHERE
-> products.pid=products_tech.pid
-> AND
-> products.pid='10';
Is there any way that I can do this validly or am I going to need to use PHP to find the type from products
to evaluate that I need to take the tech specs from products_showers
/products_boilers
?
Thanks =)