如何在查询中准确找到平均值

时间:2018-11-20 10:16:44

标签: postgresql

我想要平均值,但显示为空。我想要不同ID中的平均得分

  select avg(score*100)from daily_stats1 where id=10 and id=11

1 个答案:

答案 0 :(得分:0)

只需使用null函数摆脱coalesce的值:

select avg(coalesce(score, 0)*100)from daily_stats1 where id=10 and id=11