Re: [GENERAL] Counts and percentages and such

2009-12-16 Thread Mihamina Rakotomandimby
> jackassplus : > I'm just using squirrel to Sure! But it's bad. -- Architecte Informatique chez Blueline/Gulfsat: Administration Systeme, Recherche & Developpement +261 34 29 155 34 / +261 33 11 207 36 -- Sent via pgsql-general mailing list (pgsql-general@postgres

Re: [GENERAL] Counts and percentages and such

2009-12-08 Thread jackassplus
> My experience with Squirrel was that it worked fine for very simple > queries, and as soon as you got outside the box it started doing the > stuff the OP is seeing.  For postgresql the preferred GUI is pgadmin > III, but psql is the best text only interface for a db on the planet. > I'm just us

Re: [GENERAL] Counts and percentages and such

2009-12-08 Thread Scott Marlowe
On Tue, Dec 8, 2009 at 3:09 PM, Thomas Kellerer wrote: > jackassplus wrote on 08.12.2009 22:21: >> >> 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. > > As Scott has pointed out this is a typecast.

Re: [GENERAL] Counts and percentages and such

2009-12-08 Thread Thomas Kellerer
jackassplus wrote on 08.12.2009 22:21: 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. As Scott has pointed out this is a typecast. If Squirrel mistakes that for a parameter, it's clearly a bug in S

Re: [GENERAL] Counts and percentages and such

2009-12-08 Thread Scott Marlowe
Btw, Squirrel sucks, I tried using it in my last job and it got in the way more than it helped with pgsql. I just use psql or pgadmin III if I need a gui. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpre

Re: [GENERAL] Counts and percentages and such

2009-12-08 Thread Scott Marlowe
On Tue, Dec 8, 2009 at 2:21 PM, jackassplus wrote: > >> 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.33

Re: [GENERAL] Counts and percentages and such

2009-12-08 Thread jackassplus
> 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.3300 >  N        | 20. >  A      

Re: [GENERAL] Counts and percentages and such

2009-12-08 Thread Scott Marlowe
On Tue, Dec 8, 2009 at 11:50 AM, jackassplus wrote: > I'm new to both pgsql and SQL in  general pas really simple stuff, so > i would like to know how to; > > Given a table with a column that can have one of NULL, (char) N, > (char) A, and (char) L. Is there a way to in a single query, ge the > pe

[GENERAL] Counts and percentages and such

2009-12-08 Thread jackassplus
I'm new to both pgsql and SQL in general pas really simple stuff, so i would like to know how to; Given a table with a column that can have one of NULL, (char) N, (char) A, and (char) L. Is there a way to in a single query, ge the percentage of the whole rowset that each of those represents? lik