问题
How can I pivot row data using Informatica PowerCenter Designer? Say, I have a source file called address.txt:
+---------+--------------+-----------------+
| ADDR_ID | NAME | ADDRESS |
+---------+--------------+-----------------+
| 1 | John Smith | JohnsAddress1 |
| 1 | John Smith | JohnsAddress2 |
| 2 | Adrian Smith | AdriansAddress1 |
| 2 | Adrian Smith | AdriansAddress2 |
+---------+--------------+-----------------+
I would like to Pivot this data like this:
+---------+--------------+-----------------+-----------------+
| ADDR_ID | NAME | ADDRESS1 | ADDRESS2 |
+---------+--------------+-----------------+-----------------+
| 1 | John Smith | JohnsAddress1 | JohnsAddress2 |
| 2 | Adrian Smith | AdriansAddress1 | AdriansAddress2 |
+---------+--------------+-----------------+-----------------+
How can I do this in Informatica?
回答1:
If every person has two addresses, you can use the FIRST
and LAST
functions in an Aggregator
transformation:
来源:https://stackoverflow.com/questions/19294198/how-to-pivot-row-data-using-informatica