datamarathon / AHHF-team

1 stars 0 forks source link

Latest version of Niels' and Jiri query #9

Open nfotani opened 10 years ago

nfotani commented 10 years ago

--Filter by Sequence = 1 (primary diagnosis) and icd9 code = 428.xx. Save to file.--

DROP TABLE "USER10"."TEST_TABLE"; CREATE TABLE "USER10"."TEST_TABLE" AS

(select "MIMIC2V26"."icustay_detail"."SUBJECT_ID", "MIMIC2V26"."icd9"."HADM_ID", DOD, HOSPITAL_DISCH_DT, HOSPITAL_LOS, DOB, HOSPITAL_ADMIT_DT, ICUSTAY_ADMIT_AGE, ICUSTAY_AGE_GROUP, HEIGHT, WEIGHT_FIRST,WEIGHT_MIN, WEIGHT_MAX --(select count(*)-- --(select count(distinct "MIMIC2V26"."icd9"."SUBJECT_ID")-- from "MIMIC2V26"."icd9" inner join "MIMIC2V26"."icustay_detail" on "MIMIC2V26"."icustay_detail"."SUBJECT_ID"="MIMIC2V26"."icd9"."SUBJECT_ID" where "MIMIC2V26"."icd9"."SEQUENCE"=1-- and "MIMIC2V26"."icd9"."CODE" like '428.%' order by "MIMIC2V26"."icustay_detail"."ICUSTAY_ADMIT_AGE" desc)