Postgresql Sub Query

0

Greetings. Currently the query I am using (without variables) does the necessary work, but now I need to add variables within it.

INSERT INTO tabla2 (a,b,c,d,FK_ID) SELECT a,b,c,d FROM tabla1

In table2 I have a column fK_ID, how could I add this value to the query?

    
asked by Alex Hunter 15.12.2017 в 20:37
source

1 answer

1

Calculating the field, it can be

  INSERT INTO tabla2 (a,b,c,d,FK_ID) SELECT a,b,c,d, (1) as fk_i FROM tabla1
    
answered by 15.12.2017 / 20:41
source