INSERT INTO from SELECT

SELECT <field>[, ...]
INTO <table>
FROM <table>
WHERE <criteria>

or

INSERT INTO <table> ( <field>[, ...] )
SELECT <field>[, ...]
FROM <table>
WHERE <criteria>

example

INSERT INTO auth_users ( user_id, auth_id, auth_setting )
SELECT user_id, 1301 AS auth_id, ‘Y’ AS auth_setting
FROM evedr_users
WHERE user_id > 1

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

No comments yet.

Leave a comment

(required)

(required)