Re: Delete with join -- deleting related table entries? - Mailing list pgsql-sql

From Bryce Nesbitt
Subject Re: Delete with join -- deleting related table entries?
Date
Msg-id 43EA3445.9050401@obviously.com
Whole thread Raw
In response to Re: Delete with join -- deleting related table entries?  (Markus Schaber <schabi@logix-tt.com>)
List pgsql-sql
Markus Schaber wrote:
> 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 ; :-)
>   
Wow.  It worked.  Cool.  I guess the reservations don't get deleted
until they are not needed any more...

Not the fastest thing in the world.  But it worked.



pgsql-sql by date:

Previous
From: "Owen Jacobson"
Date:
Subject: Re: Delete with join -- deleting related table entries?
Next
From: "Owen Jacobson"
Date:
Subject: Re: Delete with join -- deleting related table entries?