我试图UPDATE queueStatusINT WHERE statusINT是8,queueStatusINT不等于2,type是$ type。 但我不断收到错误:
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘ queueStatusINT!='2’, type=’int'' at line 1
我正在使用此SQL查询来执行更新:
UPDATE $mysqlTable SET queueStatusINT='2’ WHERE statusINT='8’, queueStatusINT!='2’, type=‘$type’;
我也注意到我可以在SELECT命令中执行NOT等于...
SELECT nameTXT FROM $mysqlTable WHERE queueStatusINT!='2' ORDER BY queueStatusINT DESC, priorityINT DESC, id ASC LIMIT 7;
答案 0 :(得分:3)
您需要使用AND来组合您的条件,而不仅仅是逗号。
例如
UPDATE $mysqlTable
SET queueStatusINT = '2'
WHERE statusINT = '8'
AND queueStatusINT != '2'
AND type = '$type'
答案 1 :(得分:1)
将您的更新更改为:
UPDATE $mysqlTable
SET queueStatusINT='2’
WHERE statusINT=8
AND queueStatusINT !=2
AND type=‘$type’;
我假设queueStatusINT是一个Integer(顾名思义) - 你应该省略'',因为它们象征着一个字符串/字符。
祝福, 费边