My message #
1239975 in this thread shows how to do it using JOINs. You've to adjust it a litle bit to your new requirements.
You may also reconsider using EMPTY() function because it's not optimizable
SELECT vehicles.order_key, ;
NVL(lm.lup_value, SPACE(10)) AS Make, ;
NVL(lc.lup_value, SPACE(10)) AS Color ;
FROM vehicles ;
LEFT JOIN lookup lm ;
ON lm.lup_id = vehicles.make_key ;
LEFT JOIN lookup lc ;
ON lc.lup_id = vehicles.color_key ;
WHERE NOT EMPTY(vehicles.make_key) OR NOT EMPTY(vehicles.color_key)
>
>The different ideas gave me a lot to think about. (I put them all together for later reference) As a result, though, I was able to come up with the following solution that pulls everything into a cursor in one step instead of the two I had originally:
>SELECT vehicles.order_key, ;
> (SELECT lup_value FROM lookup ;
> WHERE lookup.lup_id = vehicles.make_key) as make, ;
> (SELECT lup_value FROM lookup ;
> WHERE lookup.lup_id = vehicles.color_key) as color ;
> FROM vehicles WHERE ;
> ! EMPTY(vehicles.make_key) or ! EMPTY(vehicles.color_key)
>
>Does anyone know how to do the exact same thing as above but changing the syntax using joins? Just so I can understand the join concept better.
>
>Thanks again all of you for your time.
>
>Marcel
--sb--