On Tue, Aug 28, 2007 at 08:00:42AM -0500, Michael Glaesemann wrote:
> >you can try to use "distinct on".
> I considered that as well, but couldn't think of a way to return more
you're right and i was wrong. i simply missed the word "two" in original
question. sorry.
depesz
--
quicksil1er: "po
On Aug 28, 2007, at 4:14 , hubert depesz lubaczewski wrote:
On Mon, Aug 27, 2007 at 06:36:47PM +0200, Claudia Kosny wrote:
Is there a way to do this with one query?
I am using PostgreSQL 7.4.
you can try to use "distinct on".
I considered that as well, but couldn't think of a way to return
On Mon, Aug 27, 2007 at 06:36:47PM +0200, Claudia Kosny wrote:
> Is there a way to do this with one query?
> I am using PostgreSQL 7.4.
you can try to use "distinct on".
depesz
--
quicksil1er: "postgres is excellent, but like any DB it requires a
highly paid DBA. here's my CV!" :)
http://www.d
On Aug 27, 2007, at 13:12 , Michael Glaesemann wrote:
select city, event, event_date, (
select count(event)
from events i
where i.city = o.city
and i.event_date < o.event_date
and event_date > current_date -- make sure they're future
events
This should be i.event
On Mon, 27 Aug 2007 13:34:09 -0400
Joel Richard <[EMAIL PROTECTED]> wrote:
> That's what I thought at first, but this is not the case. She's
> looking for the first two dates in -each- city in the table. I
> initially thought that this could be accomplished with GROUP BY and
> LIMIT, but GROU
[Please don't top post as it makes the discussion more difficult to
follow.]
On Aug 27, 2007, at 12:34 , Joel Richard wrote:
On Aug 27, 2007, at 12:51 PM, D'Arcy J.M. Cain wrote:
On Mon, 27 Aug 2007 18:36:47 +0200
Claudia Kosny <[EMAIL PROTECTED]> wrote:
I have a list of events that take p
That's what I thought at first, but this is not the case. She's
looking for the first two dates in -each- city in the table. I
initially thought that this could be accomplished with GROUP BY and
LIMIT, but GROUP BY can only give you the first date for each city,
not the first two dates for
On Mon, 27 Aug 2007 18:36:47 +0200
Claudia Kosny <[EMAIL PROTECTED]> wrote:
> I have a list of events that take place in a certain city at a certain
> date. Now I would like to have the first two (ordered by date) events
> for each city.
>
> Is there a way to do this with one query?
> I am using
Hi there
I have a list of events that take place in a certain city at a certain
date. Now I would like to have the first two (ordered by date) events
for each city.
Is there a way to do this with one query?
I am using PostgreSQL 7.4.
Thanks for any tips.
Claudia
-