× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

SQL insert query

Michael Perrenoud
Feb 06, 2015
<p>How about a simple <code>INSERT/SELECT</code> if <code>rec_2</code> and <code>rec_3</code> are absolute values:</p> <pre><code>INSERT INTO table_1 (rec_1, rec_2, rec_3) SELECT val_1, 'val_2', 'val_3' FROM other_table WHERE val_1 NOT IN (SELECT rec_1 FROM table_1) </code></pre> <p>This tip was originally posted on <a href="http://stackoverflow.com/questions/21678509/SQL%20insert%20query/21678543">Stack Overflow</a>.</p>
comments powered by Disqus