From: | jackassplus <jackassplus(at)gmail(dot)com> |
---|---|
To: | Susan Cassidy <scassidy(at)stbernard(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: how do i count() similar items |
Date: | 2010-09-09 00:55:56 |
Message-ID: | AANLkTikah-3fB4fpAisWkGMw1AZ_3kuZ-MDRA3Vp6SWh@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
>
> 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 regexes cover all the bases, without
> duplication.
>
> It still sounds like the value should be a reference to a unique value in a
> small table of operating system entries, then store the value, rather than
> the string, in the main table.
>
> Susan
>
I'll give this a shot. looks like it will work well. Regexes, I don't mind,
SQL, I'm new at. Much less the pg functions.
thanks to both you and bricklin.
From | Date | Subject | |
---|---|---|---|
Next Message | Edwin Quijada | 2010-09-09 01:46:37 | Compiling with MinGW in windows , compile but my server down |
Previous Message | Darren Duncan | 2010-09-09 00:48:47 | Re: variable name in plpgsql |