SELECT DISTINCT mt1.order_key, ;
NVL(mtm.lup_value, SPACE(10)) AS Make, ;
NVL(mtc.lup_value, SPACE(10)) AS Color ;
FROM mytable mt1 ;
LEFT JOIN mytable mtm ;
ON mt1.order_key = mtm.order_key ;
AND mtm.lup_type = "make" ;
LEFT JOIN mytable mtc ;
ON mt1.order_key = mtc.order_key ;
AND mtc.lup_type = "color"
>I have a cursor with 3 fields order_key, lup_type, lup_value.
>The data might look as follows:
>531 make FORD
>531 color BLUE
>532 make HONDA
>532 color RED
>533 color ORANGE (person didn't enter a car make)
>534...etc.
>
>These values were already retrieved from a vehicle_info table and a lookup table.
>
>How can I take these values and combine them so that it will have the following layout:
>
>order_key, veh_make, veh_color
>531, FORD, BLUE
>532, HONDA, RED
>533, , ORANGE
>
>I tried a self join but can't get the list to show unique order_key's.
>
>As always, thanks for your excellent help.
>
>Marcel
--sb--