Hi, I have a table, which contains multiple rows for a single set of records. It looks like -

pk Value ValueType
1 123 XXXX
1 234 YYYY
1 345 ZZZZ
2 1234 XXXX
2 2341 YYYY
2 2345 ZZZZ
The pk + Value + ValueType will be unique.
I need to write a sql which will combine the records with same pk as a single records i.e. the output will be as follows -

XXXX YYYY ZZZZ
123 234 345
1234 2341 2345

Any suggestion/help will be appreciated.

Assuming the number of table rows for each "record" varies: This is not easily accomplished -- if at all -- with SQL. Even if the number is fixed, it's still messy.

You'll have to program it in PL/SQL, or in the code that is accessing Oracle.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.