Skip to content

Commit

Permalink
Remove redundant join from allvisittable query (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
burrowse authored Feb 14, 2024
1 parent 9392b87 commit 371bec2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
6 changes: 1 addition & 5 deletions inst/sql/sql_server/cdm_version/v531/AllVisitTable.sql
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,8 @@ FROM (
CL1.patient,
CL1.encounterclass,
CL1.start VISIT_START_DATE,
CL2.stop VISIT_END_DATE
CL1.stop VISIT_END_DATE
FROM @synthea_schema.encounters CL1
JOIN @synthea_schema.encounters CL2
ON CL1.patient = CL2.patient
AND CL1.start = CL2.start
AND CL1.encounterclass = CL2.encounterclass
WHERE CL1.encounterclass in ('emergency','urgent')
) T1
GROUP BY patient, encounterclass, VISIT_START_DATE
Expand Down
6 changes: 1 addition & 5 deletions inst/sql/sql_server/cdm_version/v540/AllVisitTable.sql
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,8 @@ FROM (
CL1.patient,
CL1.encounterclass,
CL1.start VISIT_START_DATE,
CL2.stop VISIT_END_DATE
CL1.stop VISIT_END_DATE
FROM @synthea_schema.encounters CL1
JOIN @synthea_schema.encounters CL2
ON CL1.patient = CL2.patient
AND CL1.start = CL2.start
AND CL1.encounterclass = CL2.encounterclass
WHERE CL1.encounterclass in ('emergency','urgent')
) T1
GROUP BY patient, encounterclass, VISIT_START_DATE
Expand Down

0 comments on commit 371bec2

Please sign in to comment.