Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pkarman/b6a55159d15f5ce1b79071499f8ba04b to your computer and use it in GitHub Desktop.
Save pkarman/b6a55159d15f5ce1b79071499f8ba04b to your computer and use it in GitHub Desktop.
SELECT "appeals".*
FROM "appeals"
WHERE "appeals"."established_at" IS NOT NULL
AND ( ( appeals.updated_at >= '2021/01/01' )
OR ( appeals.id IN (SELECT "request_issues"."decision_review_id"
FROM "request_issues"
WHERE ( request_issues.updated_at >=
'2021/01/01' )
AND
( request_issues.decision_review_type = 'Appeal' )
UNION
SELECT "claimants"."decision_review_id"
FROM "claimants"
WHERE ( claimants.updated_at >= '2021/01/01' )
AND (
claimants.decision_review_type = 'Appeal' )
UNION
SELECT "decision_issues"."decision_review_id"
FROM "decision_issues"
WHERE "decision_issues"."deleted_at" IS NULL
AND ( decision_issues.updated_at >=
'2021/01/01' )
AND (
decision_issues.decision_review_type = 'Appeal' )
UNION
SELECT "tasks"."appeal_id"
FROM "tasks"
WHERE ( tasks.updated_at >= '2021/01/01' )
AND ( tasks.appeal_type = 'Appeal' )
UNION
SELECT "intakes"."detail_id"
FROM "intakes"
WHERE ( intakes.updated_at >= '2021/01/01' )
AND ( detail_type = 'Appeal' )
UNION
SELECT "hearings"."appeal_id"
FROM "hearings"
WHERE ( hearings.updated_at >= '2021/01/01' )
UNION
SELECT "available_hearing_locations"."appeal_id"
FROM "available_hearing_locations"
WHERE ( available_hearing_locations.updated_at >=
'2021/01/01'
)
AND
( available_hearing_locations.appeal_type = 'Appeal' )
UNION
SELECT "decision_documents"."appeal_id"
FROM "decision_documents"
WHERE ( decision_documents.updated_at >= '2021/01/01' )
AND ( decision_documents.appeal_type = 'Appeal' )
UNION
SELECT "vbms_uploaded_documents"."appeal_id"
FROM "vbms_uploaded_documents"
WHERE ( vbms_uploaded_documents.updated_at >=
'2021/01/01'
)
UNION
SELECT
"supplemental_claims"."decision_review_remanded_id"
FROM "supplemental_claims"
WHERE ( supplemental_claims.updated_at >= '2021/01/01' )
AND (
supplemental_claims.decision_review_remanded_type = 'Appeal' )
UNION
SELECT "special_issue_lists"."appeal_id"
FROM "special_issue_lists"
WHERE ( special_issue_lists.updated_at >= '2021/01/01' )
AND ( special_issue_lists.appeal_type = 'Appeal' )
UNION
SELECT "post_decision_motions"."appeal_id"
FROM "post_decision_motions"
WHERE ( post_decision_motions.updated_at >= '2021/01/01' )) ) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment