Re: Find "smallest common year"

Поиск
Список
Период
Сортировка
От Carlos Moreno
Тема Re: Find "smallest common year"
Дата
Msg-id 46FB9F65.9070507@mochima.com
обсуждение исходный текст
Ответ на Re: Find "smallest common year"  (Stefan Schwarzer <stefan.schwarzer@grid.unep.ch>)
Список pgsql-general
Stefan Schwarzer wrote:
> Sorry,
>
> I forgot to mention my table design, which is like this:
>
>      name             2001    2002   2003   2004   2005
> -----------------------------------------------------------------
> Afghanistan    ....
> Albania            ....
>
> (Yep, I know, bad table design.... :-)). I tried to change it to the
> more common "id | year | value" format, but there were too many SQL
> problems afterwards for the different queries/calculations we need to
> have....)

May I suggest that you concentrate on solving *those* problems instead of
the programmatically trivial computation of lowest common value?  Notice
that a *really trivial* programming exercise becomes highly involved in
your case --- if I'm understanding correctly what you have, I assume you'd
have to check one by one the fields for NULL or non-NULL values --- that's
intolerably ugly, IMHO, and it is a very simple and direct consequence of
an as-unsound-as-it-gets db/table design.

Carlos
--


В списке pgsql-general по дате отправления:

Предыдущее
От: Stefan Schwarzer
Дата:
Сообщение: Re: Find "smallest common year"
Следующее
От: Jan de Visser
Дата:
Сообщение: Re: pg_dump (8.1.9) does not output copy statements