0

This query get data from table products and JOIN data from product_details with rule check the same product ID.

$query = "SELECT p.id, 
                 p.slug, 
                 p.sku, 
                 p.price, 
                 p.vat_rate, 
                 p.stock, 
                 p.brand, 
                 p.ean, 
                 p.gender, 
                 pd.title, 
                 pd.description 
FROM products p
INNER JOIN product_details pd ON p.id = pd.id
WHERE p.stock >= 50";

I need also JOIN data from table images value: image_default and I also need check and JOIN for the same product ID but not working.

$query = "SELECT p.id, 
                 p.slug, 
                 p.sku, 
                 p.price, 
                 p.vat_rate, 
                 p.stock, 
                 p.brand, 
                 p.ean, 
                 p.gender, 
                 pd.title, 
                 pd.description,
                 pd.image_default 
FROM products p
INNER JOIN product_details, images pd ON p.id = pd.id
WHERE p.stock >= 50";

I try some like but something went wrong.

2
  • 1
    I try some like but something went wrong.,please post the full error. INNER JOIN product_details, images this is not valid. Please read Help me write this query in SQL and update the question. Nov 15 at 14:20
  • 1
    "something went wrong" --> System crashed? Your child wet himself? A tornado hit?
    – Rick James
    Nov 15 at 19:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.