Re: SQL problem

From: "Kevin T(dot) Manley \(Home\)" <kmanley(at)uswest(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: SQL problem
Date: 2001-03-07 18:12:18
Message-ID: 985tca$2rk6$1@news.tht.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)yahoo(dot)com> wrote in message
news:3AA6445B(dot)F409966F(at)yahoo(dot)com(dot)(dot)(dot)
> 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

In response to

  • SQL problem at 2001-03-07 14:23:23 from Salvador Mainé

Browse pgsql-sql by date

  From Date Subject
Next Message chard 2001-03-07 18:18:32 help
Previous Message Jie Liang 2001-03-07 18:05:13 how to reload a function