{MySQL} ERREUR 1064 (42000)

BONG03 -  
 dordouf -
Bonjour,

Voici ma requête :

insert into USER_TO_SERVICE (ID_SERVICE, ID_USER) select ($IDSERVICE, $IDUSERB) where not exists (select ID_SERVICE from USER_TO_SERVICE)

ID_SERVICE et $IDSERVICE sont des entiers ; ID_USER et $IDUSERB sont des varchar (100)

Celle-ci génère l'erreur suivante :
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 'where not exists (select ID_SERVICE from USER_TO_SERVICE)' at line 1

Quelqu'un peut-il m'aidier ?

MySQL est en version 5.0.32

Merci à tous.

Alf
A voir également:

3 réponses

Xavstarblues Messages postés 10019 Date d'inscription   Statut Contributeur Dernière intervention   1 856
 
je ne suis pas un pro mais il ne manque pas un point-virgule à la fin ?
0
BONG03
 
J'ai essyaé en mettant un ; à la fin, mais j'obtiens la même erreur...
0
sauterelle
 
Il me semble bien que INSERT INTO , SELECT WHERE... doivent être en MAJ...
0
dordouf
 
Je sais pas si ca peut t aider mais la syntaxe correcte pour une requete comme celle ci est : INSERT INTO nomtable VALUES (col1,col2,...);
0