Re: Substitute column in SELECT with static value?

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Stefan Schwarzer" <stefan(dot)schwarzer(at)grid(dot)unep(dot)ch>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Substitute column in SELECT with static value?
Date: 2007-11-16 16:19:15
Message-ID: dcc563d10711160819n6c7dfa4fyfe99f7ef787a38c8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Nov 16, 2007 4:26 AM, Stefan Schwarzer <stefan(dot)schwarzer(at)grid(dot)unep(dot)ch> wrote:
>
> Hi there,
>
> I run an aggregation on national statistics to retrieve regional values (for
> Africa, Europe, ...). Now, I want to have a global aggregation as well. The
> easiest thing for my PHP/HTML procedure would be to have the global row make
> appear within the regional result. So it would be something like
>
> name | y_2001 | y_2002 .....
> --------------------------------------------------------
> Africa | 2323 | 342323
> Europe | ....
> .....
> Global | 849309 | .....

> Is there a way to substitute this with a "static" value, such as "Global"?
> So, that the query still results in three columns?

Sure, just include it as 'Global'

Note the single, not double, quotes.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message mailtolouis2020-postgres 2007-11-16 16:26:49 Re: public schema doubt
Previous Message Scott Marlowe 2007-11-16 16:16:31 Re: public schema doubt