UPDATE using subquery with joined tables

Поиск
Список
Период
Сортировка
От Sebastian P. Luque
Тема UPDATE using subquery with joined tables
Дата
Msg-id 87txs161dk.fsf@kolob.subpolar.dyndns.org
обсуждение исходный текст
Ответы Re: UPDATE using subquery with joined tables
Re: UPDATE using subquery with joined tables
Список pgsql-general
Hi,

I need to update field1 in table1, gathering data from field1 in table2.
The following SELECT shows the data as it needs to be updated:

SELECT a.field1 || regexp_replace(b.field1, '.*(mypattern)', e'. \\1')
FROM table1 a JOIN table2 b USING (id)
WHERE a.field1 NOT LIKE '%mypattern%' AND b.field1 LIKE '%mypattern%';

I am not sure how to translate this into an UPDATE statement for fiel1
in table1 efficiently.  Any tips welcome.

Cheers,

--
Seb


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

Предыдущее
От: icholy
Дата:
Сообщение: Re: libpq error message deallocation
Следующее
От: "David Johnston"
Дата:
Сообщение: Re: UPDATE using subquery with joined tables