Re: Update two tables returning id from insert CTE Query

Поиск
Список
Период
Сортировка
От Patrick B
Тема Re: Update two tables returning id from insert CTE Query
Дата
Msg-id CAJNY3it8t1CtzWRsnUXJOs4o0zE_jSmwE3-fX6DTo=v6eKhUUg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Update two tables returning id from insert CTE Query  (Kevin Grittner <kgrittn@gmail.com>)
Ответы Re: Update two tables returning id from insert CTE Query  (Patrick B <patrickbakerbr@gmail.com>)
Список pgsql-general


2016-09-28 10:11 GMT+13:00 Kevin Grittner <kgrittn@gmail.com>:
On Tue, Sep 27, 2016 at 3:33 PM, Patrick B <patrickbakerbr@gmail.com> wrote:

> 4 - Get the table_1.c_id from the STEP NUMBER 2 and put it into table_2.c_id
> - This is the problem.. how can I get the inserted id from STEP2 and put it
> into c_id respecting the order?

For DML you need to think of the data as being unordered sets, not
ordered lists.  The whole concept of a relational database is that
related rows can be associated through their common data values.
You are splitting them apart and then trying to match them up again
to link them back together.  You will be better off if you can
leave the relationship intact all the way through -- perhaps by
adding name_last to table_1.

Can you give me examples please?
Patrick

В списке pgsql-general по дате отправления:

Предыдущее
От: Melvin Davidson
Дата:
Сообщение: Re: how to monitor the progress of really large bulk operations?
Следующее
От: Patrick B
Дата:
Сообщение: Re: Update two tables returning id from insert CTE Query