Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Snowflake insert into a table from CTE output results

with 
ct2 (emp_name,emp_id) as (
  select emp_name,emp_id  
  from "TEST_1"."PUBLIC"."TEST11"
)
insert into "TEST_1"."PUBLIC"."EMP1"  
select emp_name,emp_id 
from ct2;
like image 634
Avneesh Patel Avatar asked Sep 13 '25 02:09

Avneesh Patel


1 Answers

I guess you are looking for the correct syntax to achieve the above.

Try this:

insert into "TEST_1"."PUBLIC"."EMP1"
with ct2 (emp_name,emp_id) as (select emp_name,emp_id from "TEST_1"."PUBLIC"."TEST11")
select emp_name,emp_id from ct2;
like image 86
Marcel Avatar answered Sep 16 '25 08:09

Marcel