Em 15/04/11, Fabiano Fernandes<[email protected]> escreveu:
> Olá a todos!
>
> Estou precisando de um empurrão para criação de um select ...
>
> Alguem pode me ajudar?
>
> Tenho em uma tabela da seguinte forma:
>
>
> ID  |  PNAME  |  DESCRIPTION | NOTE |  WEIGHT
> -----+---------------+-----------------------+----------+--------------
>   3  |     Bolt     |      ACT - A       |    4.5   |     2
>   3  |     Bolt     |      ACT - A       |    5.0   |     2
>   3  |     Bolt     |      ACT - C       |    3.0   |     2
>   3  |     Bolt     |      ACT - C       |    1.0   |     2
>   3  |     Bolt     |      ACT - B       |    2.0   |     1
>   3  |     Bolt     |      ACT - B       |    0.5   |     1
>
>
>
> Preciso recuperar essas informações da seguinte forma:
>
>
>  ID  |  PNAME  |  ACT - A |  WEIGHT | ACT - C |  WEIGHT | ACT - B |  WEIGHT
> -----+---------------+-------------+--------------+-------------+---------------+------------+----------
>   3  |     Bolt     |      9.5    |        2      |     4.0     |       2
>     |     2.5    |    1
>
>
> Att
> Fabiano Fernandes
>


Veja o contrib tablefunc/crosstab:
http://www.postgresql.org/docs/current/interactive/tablefunc.html

Osvaldo
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a