sql >> Base de Datos >  >> RDS >> Mysql

Insertar SQL? insertar datos de uno a otro

Estás mezclando dos estilos diferentes de INSERT .

Para usar el mismo método que su ejemplo, necesitaría hacer:

INSERT INTO filenote(clientid, notetype, datetime, notedetails)
SELECT clientid, 'info','2011-09-29 09:00:00', 'example note'
FROM clienttable
WHERE clienttable.clientid in (1,2,3,4,5,6,7,8,9)

o usa BETWEEN :

INSERT INTO filenote(clientid, notetype, datetime, notedetails)
SELECT clientid, 'info','2011-09-29 09:00:00', 'example note'
FROM clienttable
WHERE clienttable.clientid BETWEEN 1 AND 9