In an SQL Server, we can insert rows into a table with the help of INSERT.. SELECT command. The statement is shown below :
INSERT INTO Table (col1, col2, col3)
SELECT col1, col2, col3
FROM other_table
WHERE sql = 'cool'
Can we also update a table with SELECT? Having a temporary table containing the values and also would like to update another table using those values. Perhaps something like this:
UPDATE Table SET col1, col2
SELECT col1, col2
FROM other_table
WHERE sql = 'cool'
WHERE Table.id = other_table.id