I want to search for all records in product_description who match a certain brand, and also whose status in another table product is '1'. This is how far I've got, but I'm tripping up somewhere:
SELECT brand,
name,
product_id
FROM product_description
WHERE brand = $brandname
AND product_id IN (SELECT product_id,
status
FROM product
WHERE status = '1');
Thanks in advance
Reason:
Inner query should return only 1 column if you want to use it with
IN.Solution:
Remove
statusfrom the inner query. Also use single quotes'around the variable$brandname: