Re: How to join to delete

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: How to join to delete
Дата
Msg-id 445715D6.7030706@archonet.com
обсуждение исходный текст
Ответ на How to join to delete  ("Chris Velevitch" <chris.velevitch@gmail.com>)
Ответы Re: How to join to delete  ("Chris Velevitch" <chris.velevitch@gmail.com>)
Список pgsql-general
Chris Velevitch wrote:
> I'm using pg 7.4.5 on Win XP SP1.

The first official release for Windows was 8.0, and there have been
several bugfixes to 7.4.x since then. Upgrade as soon as is practical.

> I want to delete rows from a table B, but need to join it to another
> table A in order to select the rows in B to be deleted.
>
> Eg. Delete from A join B on (A.bk = B.bk) where A.ak = x;
>
> but only delete rows from B.

Perhaps something like:
  DELETE FROM B WHERE bk IN (SELECT ak FROM A WHERE ak2 = x)

Or maybe rephrase it as EXISTS for 7.4

--
   Richard Huxton
   Archonet Ltd

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

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: PG_RETURN_?
Следующее
От: Alban Hertroys
Дата:
Сообщение: Re: How would I write this query...