I have the following working MySQL query:
SELECT
a.id id,
a.price price,
a.stock stock,
a.max_per_user max_per_user,
a.purchased purchased,
b.quantity owned
FROM
shop_items a
JOIN shop_inventory b
ON b.iid=a.id
AND b.cid=a.cid
WHERE
a.cid=1
AND a.szbid=0
AND a.id IN(3,4)
JOINjoins the table shop_inventory bfor a refund b.quantity owned. However, if shop_inventory bthere is no record in the table in which b.iid=a.idI want it to return b.quantity = 0. How should I do it?
source
share