Re: How to join to delete

Поиск
Список
Период
Сортировка
От Noel Faux
Тема Re: How to join to delete
Дата
Msg-id 4457042D.2040307@med.monash.edu.au
обсуждение исходный текст
Ответ на How to join to delete  ("Chris Velevitch" <chris.velevitch@gmail.com>)
Список pgsql-general
Hi Chris,

I think the best bet would be to use a nested select:

Delete from A WHERE A.bk = (SELECT bk FROM B) where A.ak = x;

Cheers
Noel

Chris Velevitch wrote:
> I'm using pg 7.4.5 on Win XP SP1.
>
> 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.
>
> How do I acheive this?
>
>
> Chris
> --
> Chris Velevitch
> Manager - Sydney Flash Platform Developers Group
> www.flashdev.org.au
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings


Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Return value (instead of reference) for user defined type
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: PG_RETURN_?