Sql abs功能需要帮助吗?

Sql abs功能需要帮助吗?,sql,mariadb,Sql,Mariadb,如果我写 abs((sum(daily_well_details.RegValue) / (sum(daily_well_details.Value*daily_well_details.Quantity) + sum(daily_well_details.RegValue))*100)) as accuracy 无错误-结果正常 作为最终结果,我需要(100-准确度) 我尝试了几种语法,但始终收到错误消息“…#HI000组函数的使用无效…” 您可以使用 SELECT.... ABS(100-

如果我写

abs((sum(daily_well_details.RegValue)
/ (sum(daily_well_details.Value*daily_well_details.Quantity)
+ sum(daily_well_details.RegValue))*100)) as accuracy
无错误-结果正常

作为最终结果,我需要(100-准确度)

我尝试了几种语法,但始终收到错误消息“…#HI000组函数的使用无效…”

您可以使用

SELECT.... ABS(100-(sum(daily_well_details.RegValue))/(sum(daily_well_details.Value*daily_well_details.Quantity))+(sum(daily_well_details.RegValue))*100))) as accuracy

不能在另一个聚合中使用聚合函数-SUM(SUM(X))=Error。
SELECT.... ABS(100-(sum(daily_well_details.RegValue))/(sum(daily_well_details.Value*daily_well_details.Quantity))+(sum(daily_well_details.RegValue))*100))) as accuracy