SQL problem
SQL problem
От:
Salvador Mainé <salvamaine@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
Re: SQL problem
От:
"Kevin T. Manley \(Home\)" <kmanley@uswest.net>
Дата:
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�" 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