Created
September 9, 2010 16:48
-
-
Save jaredhoyt/572155 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT "Group".abbr, COUNT("PaymentException".id) AS exception_count, AVG("PaymentException".appeals) AS appeals_average, | |
SUM("PaymentException".appeal_amount) AS appealed_total, AVG("PaymentException".appeal_amount) AS appealed_average, | |
AVG(EXTRACT(epoch FROM "PaymentException".created)) AS age_average | |
FROM exceptions "PaymentException" | |
INNER JOIN procedures "Procedure" ON "Procedure".id = "PaymentException".procedure_id | |
INNER JOIN claims "Claim" ON "Claim".id = "Procedure".claim_id | |
INNER JOIN groups "Group" ON "Group".id = "Claim".group_id | |
WHERE "PaymentException".appeal_amount > 0 | |
GROUP BY "Group".abbr | |
ORDER BY "Group".abbr; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment