Skip to content

Instantly share code, notes, and snippets.

@wkalt
Created April 16, 2015 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wkalt/856c87c322f1ef75d43c to your computer and use it in GitHub Desktop.
Save wkalt/856c87c322f1ef75d43c to your computer and use it in GitHub Desktop.
select (CASE WHEN end_time < NOW() - interval '1 hour' THEN 'unresponsive'
WHEN noop = true THEN 'noop'
ELSE status
END) as latest_report_status,
certname,
end_time from
(SELECT end_time,status,reports.certname,noop from certnames inner join reports on certnames.latest_report_id = reports.id inner join report_statuses on report_statuses.id=reports.status_id) foo;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment