Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 1A2029F9B21 for ; Wed, 12 Sep 2007 00:54:39 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 69116-08 for ; Wed, 12 Sep 2007 00:54:26 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from rrmailscan3.safenetbox.biz (mailscan3.reynolds.com.au [203.25.40.75]) by postgresql.org (Postfix) with ESMTP id 9A5559F97E8 for ; Wed, 12 Sep 2007 00:54:26 -0300 (ADT) Received: from rrmailscan3.safenetbox.biz (rrmailscan3.safenetbox.biz [127.0.0.1]) by rrmailscan3.safenetbox.biz (Postfix) with ESMTP id 7C1BF1D48435; Wed, 12 Sep 2007 13:54:25 +1000 (EST) Received: from [127.0.0.1] (online4-new.lnk.telstra.net [139.130.169.227]) (Authenticated sender: remote) by rrmailscan3.safenetbox.biz (Postfix) with ESMTP id 4BF5F1D48422; Wed, 12 Sep 2007 13:54:24 +1000 (EST) Message-ID: <46E762B4.7080102@autoledgers.com.au> Date: Wed, 12 Sep 2007 11:53:24 +0800 From: Paul Lambert User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: ogjunk-pgjedan@yahoo.com CC: pgsql-sql@postgresql.org Subject: Re: Extracting hostname from URI column References: <750084.67431.qm@web50306.mail.re2.yahoo.com> In-Reply-To: <750084.67431.qm@web50306.mail.re2.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/95 X-Sequence-Number: 29308 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