1
我能从我的数据库中获得一年的平均值。有没有办法在我的数据库中有效地获取这些数据(2017-2054),而无需每次都手动输入日期?在我从所有日期中选择平均值并将其放入新表格后,是否有可能?谢谢!如何计算一个范围内的平均值psql
lcoe=# select techindex, avg(lcoe) from lcoe where year = 2017 group by techindex;
techindex | avg
------------------------+--------------------
Combustion Turbine | 0.0564000003039837
Unscrubbed | 0.0689999982714653
Offshore | 0.119428569717067
Photovoltaic | 0.208888891670439
EGS | 0.0549999997019768
Fuel Cell | 0.115666666378578
Onshore | 0.0587692308024718
Scrubbed | 0.0556000009179115
Solar Thermal | 0.134285714477301
Combined Cycle | 0.0457142852246761
Hydrothermal | 0.104249998694286
Hydroelectric | 0.0765999995172024
IGCC | 0.0762727270749482
Distributed Generation | 0.282000001519918
Nuclear | 0.0755000002682209
Biopower | 0.125571429197277
(16 rows)`
也许你只需要将年份添加到select子句和group子句 – Leo