Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save reecestart/9280675fadedd29e48413bf51e2350cc to your computer and use it in GitHub Desktop.
Save reecestart/9280675fadedd29e48413bf51e2350cc to your computer and use it in GitHub Desktop.
Select Rows with Status that has Changed
SELECT a.aws_account_id, a.name, a.description, a.refreshed, a.status
FROM
athenatableforcsvs AS a
INNER JOIN
athenatableforcsvs AS b
ON a.aws_account_id = b.aws_account_id AND a.description = b.description
WHERE
a.status <> b.status
GROUP BY a.aws_account_id, a.name, a.description, a.refreshed, a.status
ORDER BY 1, 2, 3, 4, 5;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment