The AND
operator expects a single value on either side, but you have this:
WHERE product.product_subcategory_id = $subcategory_id
AND ( ... select that returns two columns)
The first operand is of the form X = Y
, so that's a Boolean that evaluates as true
or false
(or NULL
if the field is NULL
), but the second operand isn't a Boolean.
To get this to work, you'll need to make the second operand of AND
into a single-valued expression.