Re: Combining two SELECTs

From: <swalker(at)iglou(dot)com>
To: Eric Jain <jain(at)gmx(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Combining two SELECTs
Date: 2000-07-04 23:13:31
Message-ID: Pine.LNX.4.21.0007041910190.8797-100000@ct36753-a.jfrvil1.in.home.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


SELECT count(*), host, url, id
from log
group by host, url, id

You want to include your where and order by clauses - but that should get
you the results your looking for. I think :)

Steve

On Tue, 4 Jul 2000, Eric Jain wrote:

> Any ideas how the following two statements could be combined into a
> single one?
>
> This would greatly simplify the integration of this query into an
> existing web interface...
>
> SELECT DISTINCT host, url, id
> INTO TEMP
> FROM log
> WHERE
> host IN (SELECT host FROM robots)
> AND status IN (200, 304);
>
> SELECT host, COUNT(*) AS hits
> FROM TEMP
> GROUP BY host
> ORDER BY hits DESC;
>
>
> --
> Eric Jain
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jan Wieck 2000-07-04 23:29:16 Re: REFERENCES troubles
Previous Message Jan Wieck 2000-07-04 23:09:15 Re: [HACKERS] Re: Revised Copyright: is this more palatable?