Search Postgresql Archives

Re: Database/Table Design for Global Country Statistics

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

              http://www.postgresql.org/docs/faq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux