I have a table column with this structure:
|------ ID ------|
|- 1.20.10.00 -|
|- 1.20.10.10 -|
|- 1.20.10.20 -|
|- 1.20.20.00 -|
|- 1.20.20.10 -|
|- 1.40.10.00 -|
|- 1.40.20.00 -|
|- 1.60.10.00 -|
|- 1.60.10.00 -|
I am trying to run a query which will pivot the data into multiple columns based on the Distinct values returned by a string Like the 5 left characters in the value, the column names matching the 5 characters used in the like statement. Let me show an example of what I want to get to:
|----- 1.20. ----||----- 1.40. ----||----- 1.60. ----|
|- 1.20.10.00 -||- 1.40.10.00 -||- 1.60.10.00 -|
|- 1.20.10.10 -||- 1.40.20.00 -||- 1.60.10.00 -|
|- 1.20.10.20 -|
|- 1.20.20.00 -|
|- 1.20.20.10 -|
I'm on an Oracle 11g db, so I figured I should be using the PIVOT command, but I can't figure out how to set it up with the addition of the DISTINCT and LIKE commands. Any help would be appreciated.