0

What's wrong with this query?

SELECT ps_stock_available.quantity 
FROM ps_stock_available 
INNER JOIN ps_product_attribute ON ps_product_attribute.id_product ON ps_stock_available.id_product 
WHERE ps_product_attribute.reference =100102
1
  • 2
    Two on clauses don't normally follow each other. Commented Nov 2, 2018 at 15:06

1 Answer 1

2

I think you intend:

SELECT sa.quantity
FROM ps_stock_available sa INNER JOIN
     ps_product_attribute pa 
     ON sa.id_product = pa.id_product
WHERE pa.reference = 100102;

Notes:

  • Use table aliases. They make the query easier to write and to read.
  • The ON clause contains a boolean expression.
  • A single JOIN has a single ON clause.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.