Domanda

Nel tentativo di AGGIORNARE queueStatusINT DOVE statusINT è 8 e queueStatusINT non è uguale a 2 e il tipo è $ tipo. Ma continuo a ricevere un errore:

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

Im usando questa query SQL per fare l'aggiornamento:

UPDATE $mysqlTable SET queueStatusINT='2’ WHERE statusINT='8’, queueStatusINT!='2’, type=‘$type’;

Inoltre ho notato che io possa fare un non uguale a in un comando SELECT ...

SELECT nameTXT FROM $mysqlTable WHERE queueStatusINT!='2' ORDER BY queueStatusINT DESC, priorityINT DESC, id ASC LIMIT 7;
È stato utile?

Soluzione

È necessario usare AND per combinare i criteri, non solo le virgole.

Ad esempio

UPDATE $mysqlTable 
SET    queueStatusINT = '2'
WHERE  statusINT      =  '8'
AND    queueStatusINT != '2'
AND    type           =  '$type'

Altri suggerimenti

Cambia la tua UPDATE per:

UPDATE $mysqlTable 
SET queueStatusINT='2’ 
WHERE statusINT=8
AND queueStatusINT !=2 
AND type=‘$type’;

Presumo queueStatusINT è un numero intero (come suggerisce il nome) -. Si dovrebbe lasciare il '' in quanto simboleggiano una stringa / carattere

Un caro saluto, Fabian

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top