2
I have the following Table scenario:
+-------------------------------------------------------------+
| ID    | DATA          |       PROFISSAO       |   SEQUENCIA |
+-------| --------------|-----------------------|-------------+
| 1     | 2018-01-01    |       Professor       |   1         |
| 1     | 2018-02-01    |       Ator            |   2         |
| 1     | 2018-03-01    |       Bombeiro        |   3         |
| 2     | 2018-01-01    |       Comerciante     |   1         |
| 2     | 2018-02-01    |       Motorista       |   2         |
| 2     | 2018-03-01    |       Analista        |   3         |
+-------------------------------------------------------------+
But I want to get the following:
+---------------------------------------------------------------------------------------+
|ID |   DATA        |PROFISSAO      |DATA       |PROFISSAO      |DATA       |PROFISSAO  |
+---|---------------|---------------|-----------|---------------|-----------|-----------|
|1  |   2018-01-01  |Professor      |2018-02-01 |Ator           |2018-03-01 |Bombeiro   |
|2  |   2018-01-01  |Comerciante    |2018-02-01 |Motorista      |2018-03-01 |Analista   |
+---------------------------------------------------------------------------------------+
The SEQUENCIA column has been listed (a rank in the case).
It turns out that the Pivots that I see transform the values in the columns and do not add to the front.
It does not need to be a dynamic value because I know how many lines at most I will have, in this case it will be 3.
What is the
querythat you currently have?– Sorack
@Sorack at the moment just set up the sequence of the first table. I’m really not able to get out of place. I already used PIVOT once, but with the data turning column and not adding the columns to the front.
– Diego