RE: Combining two SELECTs - Mailing list pgsql-general

From Eric Jain
Subject RE: Combining two SELECTs
Date
Msg-id NCBBJFHBEGOIAHBCBNCLIEGPCIAA.jain@gmx.net
Whole thread Raw
In response to Combining two SELECTs  ("Eric Jain" <jain@gmx.net>)
List pgsql-general
> I don't see why this wouldn't work:
>
> SELECT log.host,count(*) as hits  FROM log, robots WHERE
> log.host=robots.host AND status IN (200,304)
> GROUP BY log.host ORDER BY hits DESC ;
>
> Len Morgan

Thanks. This does work of course, however I forgot to mention that the
query must filter out any duplicates in the 'log' table. Simplified:

time | host    | url
-----+---------+--------
001  | dec.com | index
003  | dec.com | index
011  | dec.com | index
015  | dec.com | content
057  | xyz.com | index


desired result:

host    | hits
--------+-----
dec.com | 2
xyz.com | 1


--
Eric Jain


pgsql-general by date:

Previous
From: Bill Barnes
Date:
Subject: Glade or wxPython and Postgresql
Next
From: Ned Lilly
Date:
Subject: responses to licensing discussion