代码文本SELECT
t.aoi_name,
( SELECT count(p.per_id) FROM d_person_info p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.input_date > to_date('2010-10-10','yyyy-mm-dd') and p.input_date < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_person,
( SELECT count(p.per_id) FROM d_body_check_info p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.BCI_DATE > to_date('2010-10-10','yyyy-mm-dd') and p.BCI_DATE < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_bodycheck,
( SELECT count(p.per_id) FROM D_NEWBORN_HOME_VISIT p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.new_visitDate > to_date('2010-10-10','yyyy-mm-dd') and p.new_visitDate < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_born,
( SELECT count(p.per_id) FROM D_oneChild_health_exam p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.OC_visitDate > to_date('2010-10-10','yyyy-mm-dd') and p.OC_visitDate < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_one,
( SELECT count(p.per_id) FROM D_twoChild_health_exam p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.TWC_visitDate > to_date('2010-10-10','yyyy-mm-dd') and p.TWC_visitDate < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_two,
( SELECT count(p.per_id) FROM D_CHILD_HEALTH_EXAM p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.CHE_DATE > to_date('2010-10-10','yyyy-mm-dd') and p.CHE_DATE < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_six,
( SELECT count(p.per_id) FROM D_FIRST_follow_service p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.ffs_fillDate > to_date('2010-10-10','yyyy-mm-dd') and p.ffs_fillDate < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_first,
( SELECT count(p.per_id) FROM D_follow_service_info p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.fts_wVisDate > to_date('2010-10-10','yyyy-mm-dd') and p.fts_wVisDate < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_second,
( SELECT count(p.per_id) FROM D_Postpartum_visits p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.pv_followDate > to_date('2010-10-10','yyyy-mm-dd') and p.pv_followDate < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_postpartum,
( SELECT count(p.per_id) FROM D_Postpartum_healthCheck p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.phc_followDate > to_date('2010-10-10','yyyy-mm-dd') and p.phc_followDate < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_postpartum_health,
( SELECT count(p.per_id) FROM D_DPF_Record_INFO p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.DPF_Date > to_date('2010-10-10','yyyy-mm-dd') and p.DPF_Date < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_dpf,
( SELECT count(p.per_id) FROM D_HPFS_RECORD_INFO p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.HPF_DATE > to_date('2010-10-10','yyyy-mm-dd') and p.HPF_DATE < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_hpfs,
( SELECT count(p.per_id) FROM D_GMIP_Follow_INFO p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.GMF_FollowDate > to_date('2010-10-10','yyyy-mm-dd') and p.GMF_FollowDate < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_gmf,
( SELECT count(p.per_id) FROM D_Infectious_DIS p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.DID_DDate > to_date('2010-10-10','yyyy-mm-dd') and p.DID_DDate < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_infectious,
( SELECT count(p.per_id) FROM D_Older_Case_Info p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.OLDC_follow_Date > to_date('2010-10-10','yyyy-mm-dd') and p.OLDC_follow_Date < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_older
FROM m_admin_organ_info t , s_organ_info b
WHERE t.org_id = b.org_id
and t.valid = '1' and t.area_sid like '36012210%' and b.ole_id='2'分割线
数据有百万,经理说
针对你的查询条件 来建立所以
一般where
里面包含的 条件建立个索引
会快一点分割线
但是这么优化啊。 谁能告诉我。 我真心不知道这么来做。 索引啥的。基本不是很会。