| From: | "Eric Jain" <jain(at)gmx(dot)net> |
|---|---|
| To: | <pgsql-general(at)postgresql(dot)org> |
| Subject: | RE: Combining two SELECTs |
| Date: | 2000-07-04 21:09:02 |
| Message-ID: | NCBBJFHBEGOIAHBCBNCLIEGPCIAA.jain@gmx.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ned Lilly | 2000-07-04 21:28:07 | responses to licensing discussion |
| Previous Message | planx plnetx | 2000-07-04 20:59:04 | REFERENCES troubles |