Skip to content

Instantly share code, notes, and snippets.

@brandon-beacher
Last active August 29, 2015 14:02
Show Gist options
  • Save brandon-beacher/a01a01e608834daa6038 to your computer and use it in GitHub Desktop.
Save brandon-beacher/a01a01e608834daa6038 to your computer and use it in GitHub Desktop.
update events
set reminded = all_invitees.all_reminded
from (
select all(reminded) as all_reminded
from invitees
where invitees.event_id = events.id) as all_invitees
update events
set reminded = all_invitees.all_reminded
from (
select event_id, bool_and(reminded) as all_reminded
from invitees
group by event_id) as all_invitees
where events.id = all_invitees.event_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment