8000 Using standard and non-standard concepts in criteria leads to bad query · Issue #160 · OHDSI/circe-be · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Using standard and non-standard concepts in criteria leads to bad query #160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? 8000 Sign in to your account

Closed
chrisknoll opened this issue May 13, 2021 · 0 comments · Fixed by #161
Closed

Using standard and non-standard concepts in criteria leads to bad query #160

chrisknoll opened this issue May 13, 2021 · 0 comments · Fixed by #161

Comments

@chrisknoll
Copy link
Collaborator

When creating a criteria expression that uses standard and non-standard attributes, the following query is generated:

SELECT co.* 
  FROM @cdm_database_schema.CONDITION_OCCURRENCE co
  JOIN Codesets codesets on ((co.condition_concept_id = codesets.concept_id and codesets.codeset_id = 0) 
    AND (co.condition_source_concept_id = codesets.concept_id and codesets.codeset_id = 1))

The issue is that you will never have a single join record on Codesets where the condeset_id can be both 0 and 1 in the same row, and therefore this join always fails.

The proper form of this should be:

SELECT co.* 
  FROM @cdm_database_schema.CONDITION_OCCURRENCE co
  JOIN #codesets cs on co.condition_concept_id = cs.concept_id and cs.codeset_id = 0
  JOIN #codesets cns on co.condition_source_concept_id = cns.concept_id and cns.codeset_id = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant
0