我試圖找到與分類列表連接與此查詢的所有產品:MySQL查詢()犯規的工作
SELECT p.id, product_name, added_date
FROM products p, products_to_categories ptc
WHERE ptc.category_id in ("89,88,83,87,84,85,86,82")
AND ptc.product_id=p.id and p.active="1"
group by p.id
如果我切的條件AND ptc.product_id=p.id
返回行 - 錯行的活動狀態。 使用1個查詢獲取正確信息的正確方法是什麼? - 有可能嗎? 感謝
「active」列的'datatype'是什麼? – sarwar026
active is enum('0','1') – thecore7
在ENUM中使用數字字符串通常是一個糟糕的主意。 – Barmar