Re: Database/Table Design for Global Country Statistics

Поиск
Список
Период
Сортировка
От Stefan Schwarzer
Тема Re: Database/Table Design for Global Country Statistics
Дата
Msg-id AB2B4194-783E-417B-9153-60EFAA797577@grid.unep.ch
обсуждение исходный текст
Ответ на Re: Database/Table Design for Global Country Statistics  (Tino Wildenhain <tino@wildenhain.de>)
Ответы Re: Database/Table Design for Global Country Statistics  (Richard Huxton <dev@archonet.com>)
Список pgsql-general
Thanks for the feedback and the suggestions.

A problem I have now when using the new design is the following:

As a result from my PostGres query I get something like this:

     year    |    value     |    name
---------------------------------------
    2001    |     123       |   Afghanistan
    2002    |     125       |   Afghanistan
    2003    |     128       |   Afghanistan
    2004    |     132       |   Afghanistan
    2005    |     135       |   Afghanistan

    2001    |     412       |   Albania
    2002    |     429       |   Albania
    2003    |     456       |   Albania
    2004    |     465       |   Albania
    2005    |     477       |   Albania

.....


The way it is displayed on the web (in table form) is the "usual" way:

     name             2001    2002   2003   2004   2005
-----------------------------------------------------------------
Afghanistan    ....
Albania            ....


Is there any "simple", elegant solution for PHP, so that it does this
transformation? I can't imagine that I would have to write a couple
of IFs to achieve that. But I have no other idea. Or is it a question
of writing a more elegant SQL query?

Thanks for any advice!

Stef



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

Предыдущее
От: Ron Johnson
Дата:
Сообщение: Re: Database/Table Design for Global Country Statistics
Следующее
От: Ow Mun Heng
Дата:
Сообщение: Re: Table partitioning based on multiple criterias possible?