pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kevin T. Manley \(Home\) <kmanley@uswest.net>
To: pgsql-sql@postgresql.org
Subject: Re: SQL problem
Date: Wed, 7 Mar 2001 10:12:18 -0800
Message-ID: <985tca$2rk6$1@news.tht.net> (raw)
References: <3AA6445B.F409966F@yahoo.com>

Here's one approach:

create view vw_maxrain as select max(rain) as rain, date_part('year',day) as
year from meteo group by year;
select day, meteo.rain from meteo, vw_maxrain where
meteo.rain=vw_maxrain.rain;



"Salvador Mainé" <salvamaine@yahoo.com> wrote in message
news:3AA6445B.F409966F@yahoo.com...
> Hello:
>
> I have a table with pluviometrical data
>
> meteo (rain float, day date)
>
> I want to select the the day of maximum value for each year.It should be
> something like :
>
>
> select max(rain),day from meteo group by date_part('year', day);
>
>
> but it obiously doesn't work.
> I thought of doing it with aggregates, but it's far too complicated. Is
> there an 'easy' way to do this?
>
>
>
>
> --
> Salva





view thread (8+ messages)  latest in thread

Message-ID: <985tca$2rk6$1@news.tht.net>
Permalink:  ../985tca$2rk6$1@news.tht.net/
Also on:    postgresql.org/message-id/985tca$2rk6$1@news.tht.net

 · 

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: kmanley@uswest.net
  Subject: Re: SQL problem
  In-Reply-To: <985tca$2rk6$1@news.tht.net>

* 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