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
Joakim Danielson
53.1k5 gold badges36 silver badges79 bronze badges
1 Answer 1
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
ONclause contains a boolean expression. - A single
JOINhas a singleONclause.
answered Nov 2, 2018 at 15:07
Gordon Linoff
1.3m62 gold badges706 silver badges857 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-sql
onclauses don't normally follow each other.