Owen Jacobson wrote:
> BEGIN;
> DELETE FROM note WHERE issue_id IN (SELECT issue_id FROM isuse
> WHERE reservation_id = reservation_to_delete);
> DELETE FROM isuse WHERE reservation_id = reservation_to_delete;
> DELETE FROM reservations WHERE reservation_id = reservation_to_delete;
> COMMIT;
>
> With an appropriate value or expression substituted into reservation_to_delete. This would be the "hard way", but
(asit's in a single transaction) will still protect other clients from seeing a partial delete.
Yup, that's exactly how I delete reservations one a time. But here I
need to select a few thousand reservations, and I don't think this will
work:
BEGIN; DELETE FROM note WHERE issue_id IN (SELECT issue_id FROM isuse WHERE reservation_id IN (select
reservation_idfrom reservations where date > magic); DELETE FROM isuse WHERE reservation_id IN (select
reservation_idfrom reservations where date > magic) DELETE FROM reservations WHERE reservation_id IN (select
reservation_idfrom 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....
-Bryce