From: Paul Lambert <paul.lambert@autoledgers.com.au>
To: ogjunk-pgjedan@yahoo.com
Cc: pgsql-sql@postgresql.org
Subject: Re: Extracting hostname from URI column
Date: Wed, 12 Sep 2007 11:53:24 +0800
Message-ID: <46E762B4.7080102@autoledgers.com.au> (raw)
In-Reply-To: <750084.67431.qm@web50306.mail.re2.yahoo.com>
References: <750084.67431.qm@web50306.mail.re2.yahoo.com>
ogjunk-pgjedan@yahoo.com wrote:
>
> And what I'd like is something that would give me the counts for the number of occurrences of each unique hostname. Something much like `uniq -c'. Can anyone tell me how that's done or where I should look for info? (I'm not sure what to look for, that's the problem).
>
> Thanks,
> Otis
>
Just use distinct...
test=# select distinct count(*),substring( href from '.*://([^/]*)' ) as
domain from url group by domain order by domain;
count | domain
-------+--------------------------
3 | devedge.netscape.com
1 | dictionary.reference.com
2 | forums.mozillazine.org
1 | groups.google.com
4 | texturizer.net
11 | www.google.com
2 | www.mozillazine.org
(7 rows)
--
Paul Lambert
Database Administrator
AutoLedgers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: paul.lambert@autoledgers.com.au, ogjunk-pgjedan@yahoo.com
Subject: Re: Extracting hostname from URI column
In-Reply-To: <46E762B4.7080102@autoledgers.com.au>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox