首页 > 其他分享 >解决“ORA-00937: 不是单组分组函数”报错

解决“ORA-00937: 不是单组分组函数”报错

时间:2023-02-07 18:23:51浏览次数:60  
标签:code price drug 报错 单组分 00937 retail public PRES

原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

相关文章