i need count columns has null values , not null values each row, don't have idea of how can in postgresql.
you need specify column name in count(), skip null:s
select avg(c),count(c) (select generate_series(1,10) union select null) a(c);
ignore stuff after from, it's return list of values
to make more clear:
select avg(c), count(c) count_column, count(*) count_star, sum(c), array_agg(c) ( select generate_series(1,10) union select null order 1 ) a(c); avg | count_column | count_star | sum | array_agg --------------------+--------------+------------+-----+----------------------------- 5.5000000000000000 | 10 | 11 | 55 | {1,2,3,4,5,6,7,8,9,10,null} (1 row)
Comments
Post a Comment