Re: DELETE with JOIN

Поиск
Список
Период
Сортировка
От Ragnar
Тема Re: DELETE with JOIN
Дата
Msg-id 1218128738.10575.15.camel@localhost.localdomain
обсуждение исходный текст
Ответ на DELETE with JOIN  (felix@crowfix.com)
Ответы Re: DELETE with JOIN  (felix@crowfix.com)
Список pgsql-sql
On fim, 2008-08-07 at 09:14 -0700, felix@crowfix.com wrote:
> I want to delete with a join condition.  Google shows this is a common
> problem, but the only solutions are either for MySQL or they don't
> work in my situation because there are too many rows selected.  I also
> have to make this work on several databases, includeing, grrr, Oracle,
> so non-standard MySQL "solutions" are doubly aggravating.
> 
>     DELETE FROM a WHERE a.b_id = b.id AND b.second_id = ?
> 
> I have tried to do this before and always found a way, usually
> 
>     DELETE FROM a WHERE a.b_id IN (SELECT id FROM b WHERE second_id = ?)

did you look at DELETE FROM table1 USING table2 WHERE ... ?

gnari




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

Предыдущее
От: felix@crowfix.com
Дата:
Сообщение: DELETE with JOIN
Следующее
От: Steve Midgley
Дата:
Сообщение: Re: DELETE with JOIN