原SQL:
select distinct a.begin_exec_time,b.drug_code,b.drug_name,b.drug_spec,sum(b.public_retail_price*a.total_drug) as "总金额",b.public_retail_price from ZOEPRES.PRES_INP_PRES_RECORD a,ZOEDICT.DIC_DRUG_DICT b where b.print_form_code=01
结果:报“ORA-00937: 不是单组分组函数”错误。
更改后SQL:
select distinct a.begin_exec_time,b.drug_code,b.drug_name,b.drug_spec,sum(b.public_retail_price*a.total_drug) as "总金额",b.public_retail_price from ZOEPRES.PRES_INP_PRES_RECORD a, ZOEDICT.DIC_DRUG_DICT b where b.print_form_code=01 group by a.begin_exec_time,b.drug_code,b.drug_name,b.drug_spec,b.public_retail_price
结果:完美解决!
标签:code,price,drug,报错,单组分,00937,retail,public,PRES From: https://www.cnblogs.com/java-lumanman/p/17099414.html