i have a table test1 as create test1(f1 integer, f2 integer);
select * from test1 will return
f1 | f2
--+--
1 | 2
2 | 3
3 | 4
4 | 5
5 | 6
(5 rows)
select to_char(avg(f1),'FM999999.99') from test will yield
to_char
--------
3
(1 row)
select to_char(avg(f1),'FM999999.99') from test where f2 <= 5 will yield
to_char
--------
2.5
(1 row)
select to_char(avg(f1),'FM999999.99') from test where f2 > 7 will yield
to_char
--------
(1 row)
is their a way to make the value zero if the return is null?