Transposing data

Поиск
Список
Период
Сортировка
От Hans-Jürgen Schönig
Тема Transposing data
Дата
Msg-id 3B081E2D.BB24DBE3@cybertec.at
обсуждение исходный текст
Список pgsql-sql
I want the values in column label to be displayed in the a-axis. Is
there an easy way to transform the data:
Here is the input data:age_code | label | count
----------+-------+-------age_1    | 30k   |     1age_1    | 50k   |     2age_1    | more  |     2age_2    | 40k   |
2age_3    | 40k   |     1
 

I want the result to be:

age_code | 30k | 40k | 50k  | more
-----------------------
age_1       | 1      |         |    2   | 1
age_2       |         |      2 |
age_3       |          |     1 |         |

Is there any easy way to do the job or do I have to write a PL/pgSQL
function?
   Hans



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

Предыдущее
От: BOUCHPAN-LERUST-JUERY Lionel
Дата:
Сообщение: Help with ECPG on debian Potato
Следующее
От: "Mikheev, Vadim"
Дата:
Сообщение: RE: [HACKERS] Re: possible row locking bug in 7.0.3 & 7.1