select and insert in one query sql code example
Example 1: insert select
INSERT INTO table2
SELECT * FROM table1
WHERE condition;
Example 2: sql server insert into select
INSERT INTO sales.addresses (street, city, state, zip_code)
SELECT
street,
city,
state,
zip_code
FROM
sales.customers
ORDER BY
first_name,
last_name;