>
> Use a CASE statement?
>
> something like:
> select case WHEN os ~* E'^windows' then 'windows'
> WHEN os ~* E'server' then 'server'
> WHEN os ~* E'nix$' then '*nix'
> else 'other' end
> as osval, count(*) from os_tbl group by osval order by osval;
>
> The hard part is making sure your
> To ensure data integrity,
> you should probably create a fruit_type table with a unique column that
> lists the possible types, and then foreign key the fruit_type column in
> the fruits table to that to ensure nothing funky is entered. An enum
> for type is another possibility.
In the real
lets say I hve the following in the 'fruits' table:
Round orange
Sunkist orange
navel orange
strawberry
blueberry
sunkist orange
apple
how would I get something like the following:
count as c | Fruit type
-
4 | orange
2 | berry
1
> 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
> 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
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