Skip to content

Instantly share code, notes, and snippets.

@theory
Created December 19, 2016 01:06
Show Gist options
  • Save theory/0932ef35463ffb1e78c678daba005a7a to your computer and use it in GitHub Desktop.
Save theory/0932ef35463ffb1e78c678daba005a7a to your computer and use it in GitHub Desktop.
create table mass_email_recipients (
id integer,
mass_email_send_id integer,
status integer
);
insert into mass_email_recipients
values (240, 154, 1),
(241, 154, 1),
(241, 154, 0);
begin;
select id from mass_email_recipients
where mass_email_send_id = 154 and status = 1;
update mass_email_recipients set status = 2 where id in (
select id from mass_email_recipients
where mass_email_send_id = 154 and status = 1
);
rollback;
BEGIN;
update mass_email_recipients set status = 2
where mass_email_send_id = 154 and status = 1;
ROLLBACK;
drop table mass_email_recipients;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment