Re: Find min year and min value

Поиск
Список
Период
Сортировка
Искать
От
Stefan Schwarzer
Тема
Re: Find min year and min value
Дата
Msg-id
30A13818-F770-426D-9341-ACF828569617@grid.unep.ch
Ответ на
Список
Дерево обсуждения
Find min year and min value Stefan Schwarzer <stefan.schwarzer@grid.unep.ch>
Re: Find min year and min value Richard Huxton <dev@archonet.com>
Re: Find min year and min value Stefan Schwarzer <stefan.schwarzer@grid.unep.ch>
Re: Find min year and min value Richard Huxton <dev@archonet.com>
Re: Find min year and min value Stefan Schwarzer <stefan.schwarzer@grid.unep.ch>
Re: Find min year and min value Michael Glaesemann <grzm@seespotcode.net>
Re: Find min year and min value hubert depesz lubaczewski <depesz@depesz.com>
Re: Find min year and min value Richard Huxton <dev@archonet.com>
Re: Find min year and min value Steve Crawford <scrawford@pinpointresearch.com>
Re: Find min year and min value Michael Glaesemann <grzm@seespotcode.net>
Re: Find min year and min value Stefan Schwarzer <stefan.schwarzer@grid.unep.ch>
Re: Find min year and min value Michael Glaesemann <grzm@seespotcode.net>
Re: Find min year and min value Stefan Schwarzer <stefan.schwarzer@grid.unep.ch>
Re: Find min year and min value Michael Glaesemann <grzm@seespotcode.net>
Re: Find min year and min value Stefan Schwarzer <stefan.schwarzer@grid.unep.ch>
Re: Find min year and min value Michael Glaesemann <grzm@seespotcode.net>
Re: Find min year and min value Stefan Schwarzer <stefan.schwarzer@grid.unep.ch>
>> Hi there,
>> I am trying to find in a table with different variables, countries  
>> and years the
>>     lowest year
>> and within that year the
>>     lowest value
>> The following SELECT works, but I wonder if it is "elegant". Can  
>> you recommend any other solution?
>
> SELECT value AS minv FROM public_on_table.data
> WHERE id_variable = 1
> ORDER BY year, value LIMIT 1

But that brings only the min value, not the min year. I need to know  
both of them, something like

      (min year = ) 1972, (min value = ) 20

Stef

В списке pgsql-general по дате отправления
От: Richard Huxton
Дата:
Сообщение: Re: Execution plan caching
От: Richard Huxton
Дата:
FAQ