Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save tu-trinh-scale/abb750a63c4b90935144781ed6c88745 to your computer and use it in GitHub Desktop.

Select an option

Save tu-trinh-scale/abb750a63c4b90935144781ed6c88745 to your computer and use it in GitHub Desktop.
WITH threshold AS (
SELECT AVG("aCL IgM") AS avg_igm
FROM Examination
WHERE "aCL IgM" IS NOT NULL
)
SELECT DISTINCT e.Symptoms
FROM Examination e
JOIN Patient p ON p.ID = e.ID
CROSS JOIN threshold t
WHERE p.Admission = '+'
AND e."Examination Date" BETWEEN '1995-01-01' AND '1999-12-31'
AND e.Thrombosis = '2'
AND e."ANA Pattern" LIKE '%S%'
AND e."aCL IgM" < t.avg_igm
AND e.Symptoms IS NOT NULL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment