Search Postgresql Archives

Re: Counts and percentages and such

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



<snip>
> select coalesce(col,'Null'),
> (count(coalesce(col,'Null'))::numeric/(select count(*) from
> some_table))*100 from some_table group by col;
>  coalesce |        ?column?
> ----------+-------------------------
>  Null     | 13.33333333333333333300
>  N        | 20.00000000000000000000
>  A        | 26.66666666666666666700
>  L        | 40.00000000000000000000
>
> Note that it works, but we get long ugly numbers, and the column has
> no name (?column?).  Let's fix that:

What does ::numeric signify?
I'm using the jdbc driver from http://jdbc.postgresql.org/ in SQuirreL
and it asks me for the value of :numeric.


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux