RE: Combining two SELECTs
От
Eric Jain
Тема
RE: Combining two SELECTs
Дата
Msg-id
NCBBJFHBEGOIAHBCBNCLIEGPCIAA.jain@gmx.net
Список
Дерево обсуждения
Combining two SELECTs "Eric Jain" <jain@gmx.net>
Re: Combining two SELECTs Tom Lane <tgl@sss.pgh.pa.us>
RE: Combining two SELECTs "Eric Jain" <jain@gmx.net>
Re: Combining two SELECTs <swalker@iglou.com>
> 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 по дате отправления