spiritssight Posted February 5, 2008 Share Posted February 5, 2008 Hello there, I have the following code: INSERT INTO block (fin, who_blocked) VALUES (irs_rawdata.EIN, 'S-123456789') WHERE NOT EXISTS ( SELECT * FROM irs_rawdata PNO LIKE '%blind%' OR PNO LIKE '%deaf%' OR NTEE_Code LIKE '%P87%' ); I have done it with using * in the select and also with EIN as this is the only field need to be inserted into the block table, what am I doing wrong as its saying that there is a error near the WHERE NOT EXISTS clause? Thanks for any help! Sincerely, Christopher Quote Link to comment Share on other sites More sharing options...
toplay Posted February 5, 2008 Share Posted February 5, 2008 You can't have a "where" condition after "values" like that in the "insert". You can specify a "select" to retrieve values from another table to be used to "insert" (and for that you place the "select" right after "values"). Look at the Insert syntax in the manual: http://dev.mysql.com/doc/refman/5.0/en/insert.html Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.