下面是該查詢我MySQL的縮短查詢 - 選擇具有複式或選擇
SELECT FB_TEXT
FROM `FB_DATA`
WHERE `FB_MODELID` = "'.$sku_modelid.'" AND FB_TYPEID = 1
我想要做的就是讓多個FB_TYPEID的這樣的查詢應該是這樣的:
AND FB_TYPEID = 1,2,7
1, 2和7是我需要允許的數字。我怎麼能寫,沒有做很長的查詢說:
SELECT FB_TEXT
FROM `FB_DATA`
WHERE `FB_MODELID` = "'.$sku_modelid.'" AND FB_TYPEID = 1 OR `FB_MODELID` = "'.$sku_modelid.'" AND FB_TYPEID = 2 OR `FB_MODELID` = "'.$sku_modelid.'" AND FB_TYPEID = 7
'IN()'子句是你在這裏需要的。 'WHERE FB_MODELID IN(1,2,7)' –