Quantcast
Channel: Question and Answer » postgresql
Viewing all articles
Browse latest Browse all 1138

postgresql insert from select query, plus static values

$
0
0

Referring to How to insert values into a table from a select query in PostgreSQL?,

I would like to INSERT into a table rows from another, specified by a SELECT DISTINCT, plus some static values, something like:

INSERT INTO new_tbl (column1, column2, column3)
SELECT DISTINCT id FROM -- long where clause --, 
  'a string', 0;

So that every row in the new table will get the same values for column2 and column3 Is this possible?


Viewing all articles
Browse latest Browse all 1138

Trending Articles