pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vortex <vortex25@gmx.de>
To: pgsql-sql@postgresql.org
Subject: Re: select within aggregate?
Date: Fri, 6 May 2005 10:40:30 +0200
Message-ID: <20050506104030.3e725437.vortex25@gmx.de> (raw)

On Fri, 6 May 2005 13:34:26 +0530
"Ramakrishnan Muralidharan" <ramakrishnanm@pervasive-postgres.com> wrote:

> SELECT abc.remote_host ,  c , abc.request_uri , a.t FROM abc , ( select remote_host , count(*) as c , max( ts ) as t from abc group by remote_host ) as a 
> where a.remote_host = abc.remote_host and abc.ts = a.t

I thought about this too. But what happens if there are accidentally two
sets with same timestamp in the table? I suppose the outer select would
match both of them. But a DISTINCT should help to avoid this.
Ok, if you think this is the propper way to meet the
requirement i will do so.

Thank you for your answer!

Klaus




view thread (5+ messages)  latest in thread

Message-ID: <20050506104030.3e725437.vortex25@gmx.de>
Permalink:  ../20050506104030.3e725437.vortex25@gmx.de/
Also on:    postgresql.org/message-id/20050506104030.3e725437.vortex25@gmx.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: vortex25@gmx.de
  Subject: Re: select within aggregate?
  In-Reply-To: <20050506104030.3e725437.vortex25@gmx.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox