I am trying to figure out a way to do this.
I have a table with only read access, so let's call it existing_table. I want to have a reference table using "with as" statement and insert a new row to my reference table.
My code is: (pretend existing_table is ready for use)
INSERT INTO NEW_TABLE ( COLUMN_A, COLUMN_B)
VALUES (1, 'A')
WITH NEW_TABLE
AS (SELECT * from EXISTING_TABLE)
SELECT * from NEW_TABLE
However, it doesn't work. Help please!!!!! "WITH" is where it gives me the error. if I move insert into statement after with as then "INSERT" is where it gives me the error.
My question is how can I use with/insert/select statement?
;after the insert statement, and after your select statement, and whatever GUI/CLI you're using to run the queries in is trying to run them both, thinking they're one big statement.