Re: Extracting hostname from URI column

From: Paul Lambert <paul(dot)lambert(at)autoledgers(dot)com(dot)au>
To: ogjunk-pgjedan(at)yahoo(dot)com
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Extracting hostname from URI column
Date: 2007-09-12 03:53:24
Message-ID: 46E762B4.7080102@autoledgers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

ogjunk-pgjedan(at)yahoo(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message chester c young 2007-09-12 03:56:19 Re: Extracting hostname from URI column
Previous Message chester c young 2007-09-12 03:47:01 Re: Extracting hostname from URI column