I'm trying to do this query to update a table with data selected from another table
INSERT INTO `sterap_produit_non_steril_beta` (`id`, `loc`, `nsn`, `descrip_nl`, `descrip_fr`, `marque`, `ref`) VALUES (NULL, 'loca', 'nsn', '', 'ald', '', '')
SELECT `nsn`,`ald`,`qt`,`loca` FROM `stock_mhns` WHERE `loca`<> '' AND `nsn` NOT IN (SELECT nsn FROM `sterap_produit_non_steril_beta` );
When I try the queries separately, no problem !! But both I have an
Error "Unexpected Token. (Near" SELECT ""
I'm not a sql specialist but I can't see the syntax error Thanks for your help Stephane
;
..'', ''); SELECT..
– Frankich Oct 22 '20 at 8:34VALUES ()
orSELECT
results ? – FaNo_FN Oct 22 '20 at 8:42SELECT
you have to remove theVALUES
statement. Then the format will looks likeINSERT INTO Table (f1, f2..) SELECT null, f2 FROM table2 WHERE...
– Frankich Oct 22 '20 at 9:04