日期:2014-05-16  浏览次数:20833 次

诡异的数据问题
表的数据RYX_STEP_7_2由RYX_STEP_7_1分组求和生成,对表RYX_STEP_7_2列求和与表RYX_STEP_7_1求和的数据都不一致,不知道问题出在哪,求大神帮忙解决下。
代码如下:
INSERT INTO RYX_STEP_7_2
SELECT 
  AGMT_ID,
  PROD_ID_IN_BUSINESS_SYS,
  ZYLB,
  PLANNED_END_DATE,
  INCEPTION_DATE,
  MASTER_PROD_ID,
  ISSUE_SYS,
  NVL(SCHOOL_TYPE,0),
  SECTION_ID,
  DQD,
  SUM(Number_of_incepted_insured) Number_of_incepted_insured,
  SUM(Number_of_exposure) Number_of_exposure,
  SUM(Number_of_inception_policy) Number_of_inception_policy,
  SUM(Underwriting_premium) Underwriting_premium,
  SUM(Inception_sum_insured) Inception_sum_insured,
  SUM(Maturity_premium) Maturity_premium,
  SUM(Underwriting_sum_insured) Underwriting_sum_insured,
  SUM(Inception_premium) Inception_premium,
  SUM(Settled_claim_amount) Settled_claim_amount,
  SUM(Settled_claim_amount_seven) Settled_claim_amount_seven,
  SUM(Number_of_person_in_loss_event) Number_of_person_in_loss_event,
  SUM(Outstanding_estimation) Outstanding_estimation,
  SUM(Construction_sum_insured) Construction_sum_insured,
  SUM(Construction_price) Construction_price,
  SUM(Construction_area) Construction_area,
  SUM(Num_of_ocm_Assmnt) Num_of_ocm_Assmnt,
  SUM(Num_of_set_clm) Num_of_set_clm, 
  SUM(Person_in_claims_rejected) Person_in_claims_rejected,
  SUM(Number_of_set_clm) Number_of_set_clm,
  SUM(Num_of_ocm_clm) Num_of_ocm_clm,
  SUM(Construction_exposure) Construction_exposure,
  SUM(Num_of_incepted_insured) Num_of_incepted_insured,
  SUM(Num_of_exposure) Num_of_exposure
FROM RYX_STEP_7_1
GROUP BY AGMT_ID,PROD_ID_IN_BUSINESS_SYS,
ZYLB,PLANNED_END_DATE,INCEPTION_DATE,MASTER_PROD_ID,ISSUE_SYS,NVL(SCHOOL_TYPE,0),SECTION_ID,DQD;

结果集 1
SELECT 
  SUM(Number_of_incepted_insured) Number_of_incepted_insured,
  SUM(Number_of_exposure) Number_of_exposure,
  SUM(Number_of_inception_policy) Number_of_inception_policy,
  SUM(Underwriting_premium) Underwriting_premium,
  SUM(Inception_sum_insured) Inception_sum_insured,
  SUM(Maturity_premium) Maturity_premium,
  SUM(Underwriting_sum_insured) Underwriting_sum_insured,
  SUM(Inception_premium) Inception_premium,
  SUM(Settled_claim_amount) Settled_claim_amount,
  SUM(Settled_claim_amount_seven) Settled_claim_amount_seven,
  SUM(Number_of_person_in_loss_event) Number_of_person_in_loss_event,
  SUM(Outstanding_estimation) Outstanding_estimation,
  SUM(Construction_sum_insured) Construction_sum_insured,
  SUM(Construction_price) Construction_price,
  SUM(Construction_area) Construction_area,
  SUM(Num_of_ocm_Assmnt) Num_of_ocm_Assmnt,
  SUM(Num_of_set_clm) Num_of_set_clm, 
  SUM(Person_in_claims_rejected) Person_in_claims_rejected,
  SUM(Number_of_set_clm) Number_of_set_clm,
  SUM(Num_of_ocm_clm) Num_of_ocm_clm,
  SUM(Construction_exposure) Construction_exposure,
  SUM(Num_of_incepted_insured) Num_of_incepted_insured,
  SUM(Num_of_exposure) Num_of_exposure
FROM RYX_STEP_7_1;

结果集 2
SELECT 
  SUM(Number_of_incepted_insured) Number_of_incepted_insured,
  SUM(Number_of_exposure) Number_of_exposure,
  SUM(Number_of_inception_policy) Number_of_inception_policy,
  SUM(Underwriting_premium) Underwriting_premium,
  SUM(Inception_sum_insured) Inceptio