我有一個查詢NOT IN
。我聽說MySQL不支持NOT IN
,但我不知道如何重寫它。mysql不在重寫查詢問題
我的查詢是:
SELECT * FROM quests
WHERE id NOT IN ('" .$quest_completed. "')
AND location=" .$location_id. "
AND (follows=0 OR follows IN ('" .$quest_completed. "'))
ORDER BY title
如:
SELECT * FROM quests
WHERE id NOT IN (6,21) AND
location=8 AND
(follows=0 OR follows IN (6,21))
ORDER BY title
行ID 6中,當我指定WHERE id NOT IN 6
的MySQL不支持'NOT IN':http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html#function_not-in – 2012-04-27 00:58:42
你得到的錯誤是什麼? – 2012-04-27 00:58:46
哦,也許是我的查詢。它返回我不想要的行。 – user1022585 2012-04-27 00:59:22