I have an Oracle 11g table and its contents are like this:
ID V1 F1 F2 F3
1 p 12 null null
2 q null 11 null
2 r null null 17
4 r null null 23
5 p 8 null null
4 p 18 null null
4 q null 56 null
7 p 17 null null
How can I write a query that will give following O/P:
ID F1 F2 F3
1 12 null null
2 null 11 17
4 18 56 23
5 8 null null
7 17 null null
The Value of V1 in the first table could only be "p", "q" or "r".
If V1=p then we only need its F1 value.
If V1=q then we only need its F2 value.
If V1=r then we only need its F3 value.
And the O/P needs to have unique ID value.
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…