I have a main product table with different products. Different products have different specs, so I've created separate specs tables for each product (there will be more than ten of them). What I want to do is to show individual product's specs on a product_page.php whenever the product is clicked.
My product page has columns:
id - SKU - prod_name - prod_desc....
My specs table columns
id - SKU - prod_specs....
So I want to take SKU from first table and search the rest of the table with this UNIQUE sku and wherever it is show the rest of the field from that table
What I do is
SELECT SKU FROM products AS p
INNER JOIN cpu_specs AS cs ON cs.SKU = p.SKU
INNER JOIN hdd_specs AS hs ON hs.SKU = p.SKU
WHERE p.SKU = $productSKU "
But it gives me an error.
If I do SELECT *
then it fetches all the info from both tables