insert into table with nest query

From: e-letter <inpost(at)gmail(dot)com>
To: pgsql-novice(at)lists(dot)postgresql(dot)org
Subject: insert into table with nest query
Date: 2023-04-25 15:43:39
Message-ID: CAET1fe5dXJGcvFFV=RzOQ3q+d-vVXK4k0ARb8QbA47Vyuv43nA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Readers,

table1
column1,column2
value1,value2

table2
column2,column3
value2, value3

table3
column1,column2,column3
value1,value2,value3

When value3 is first entered into table2, what are the correct
commands for value2 (in table2) and value1 (in table1) to be selected
for insertion into table 3?

INSERT INTO table3 SELECT ... WHERE value3='...';

The conceptual difficulty is how to use nested query correctly, or is
there a better method? Thank you.

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Laurenz Albe 2023-04-27 09:28:03 Re: insert into table with nest query
Previous Message Johan Antonissen 2023-04-17 18:06:43 Re: