Re: Delete with join -- deleting related table entries?

From: Markus Schaber <schabi(at)logix-tt(dot)com>
To: Bryce Nesbitt <bryce1(at)obviously(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Delete with join -- deleting related table entries?
Date: 2006-02-08 17:55:14
Message-ID: 43EA3082.1010804@logix-tt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi, Bryce,

Bryce Nesbitt wrote:

> BEGIN;
> DELETE FROM note WHERE issue_id IN (SELECT issue_id FROM isuse
> WHERE reservation_id IN
> (select reservation_id from reservations where date > magic);
> DELETE FROM isuse WHERE reservation_id IN
> (select reservation_id from reservations where date > magic)
> DELETE FROM reservations WHERE reservation_id IN
> (select reservation_id from reservations where date > magic)
> COMMIT;
>
> I suppose I can do the subselect as a perl wrapper, but I was thinking
> that maybe SQL could do it all for me....

Why do you think this won't work? (provided you add the missing ) and ; :-)

Markus

--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Owen Jacobson 2006-02-08 17:56:28 Re: Delete with join -- deleting related table entries?
Previous Message Bryce Nesbitt 2006-02-08 17:41:49 Re: Delete with join -- deleting related table entries?