Skip to content

Instantly share code, notes, and snippets.

@Gizmokid2005
Created March 18, 2014 16:20
Show Gist options
  • Save Gizmokid2005/9623528 to your computer and use it in GitHub Desktop.
Save Gizmokid2005/9623528 to your computer and use it in GitHub Desktop.
SELECT
DISTINCT
patient_id
FROM
procedures as pr
join patients as pa on pa.patient_id = pr.patient_id
WHERE
pr.TimeOfService >= '01/01/2010'
AND NOT EXISTS (SELECT * FROM procedures AS pr2 WHERE pr2.patient_id = pr.patient_id AND pr.TimeOfService < '01/01/2010')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment