Anti-pivot
Hello,
I have a table which has 3 columns: user id, key and value. A user may
only have one instance of a given key. However, the key may have
multiple values; these are held as comma-separated values within the
value column (there can be any number of these values in the row). An
example:
User_id Key Value
------- ------ -----
1 MY_KEY 1
2 MY_KEY 1,2,3
Firstly: yes, I know this is *extremely* hideous database design; I
cringed when I saw it. Unfortunately, the design is set in stone and I
not able to change it.
The question is, is there any way of getting out the values with one
row
for each in SQL*Plus? So, for example, getting the values for key
MY_KEY
for user_id 2 would produce:
User_id Key Value
------- ------ -----
2 MY_KEY 1
2 MY_KEY 2
2 MY_KEY 3
I've had a quick look at pivoting queries but they seem to be doing
the
opposite of what I'm doing here.
Version: 10.2.0.1.0
Many thanks,
Oaf
.
Relevant Pages
- Re: Stonemasons and Coders
... > I always had the impression that the journeyman ... > ability of a given stone to support those above it, ... > design, just like most draughtsmen don't, they can often understand ... some manager may observe that the "system designer" ... (comp.programming) - Re: Seans Smooth granite block
... the exact opposite point of the stone as a measure of distance from the ... distance, with many points being at the extremes of this range. ... no significant surface irregularities on a sphere. ... is very "germane" to the detection of design. ... (talk.origins) - Re: Ray Martinez
... were asked how the stone came to be there, I might possibly answer, ... I can only infer that since Paley cannot see design in a ... Ray, you are not a "we", you are speaking for yourself, and yourself only. ... or general similarities indicating evolution is ... (talk.origins) - Re: History: Whom to thank for "interstates" concept
... established the first generation of 'Autobahn' geometric design standards, provided for three design classes with separate maximum ... In 1942 a new standards document was issued with four design classes--flat country, rolling terrain, low mountainous terrain, high mountainous terrain. ... The Autobahn is constructed of concrete only. ... At one point the SS tried to produce granite for architectural purposes in several of its concentration camps, but after a significant quantity of stone was produced, it was discovered the quality was not acceptable for building work. ... (misc.transport.road) - Re: Ray Martinez
... were asked how the stone came to be there, I might possibly answer, ... and it should be inquired how the watch happened to ... I can only infer that since Paley cannot see design in a ... case evolutionists present to explain the 'watch.' ... (talk.origins) |
|