how many patients had d & c nec procedure two times until 2 years ago?
select count( distinct t1.subject_id ) from ( select admissions.subject_id, count(*) as c1 from procedures_icd join admissions on procedures_icd.hadm_id = admissions.hadm_id where procedures_icd.icd9_code = ( select d_icd_procedures.icd9_code from d_icd_procedures where d_icd_procedures.short_title = 'd & c nec' ) and datetime(procedures_icd.charttime) <= datetime(current_time,'-2 year') group by admissions.subject_id ) as t1 where t1.c1 = 2