Question : Can I look up a value in a table to include in my result set?

Hello All:
My result set is as follows:
Date             Description             CodeID
1/15/10        Garden                    536
3/10/10         Living Room            653
4/15/10         Patio                        320
4/25/10         Kitchen                     223

I need to get the description code (not the CodeID)but this description code is about 12 tables away from my result set.  The Codes table is set up as follows:
CodeID    DescriptionCode
223          Repair Cabinets
320          Get New Chairs
536           Replace Orchids
653           Install Flat panel TV Set

I need to get this result:
Date             Description             CodeID
1/15/10        Garden                    Replace Orchids
3/10/10         Living Room            Install Flat panel TV Set
4/15/10         Patio                        Get New Chairs
4/25/10         Kitchen                    Repair Cabinets


My from clause is already made up of about 6 joins to get to the result set. I including only the most relevant fields. It would take me another 10 joins to get to the codes table.  Is there an easy way i can look up the code id and put it on my result set instead of the code id?  Please include a sample.  Thank you so much for your help.  
Gloria Galvez

Answer : Can I look up a value in a table to include in my result set?

I am equally mystified about the 12 tables statement!

However,  what ever your current query is, the following approach should work.  Simply wrap your current statement up as an inline view :

Select ILV.Date, ILV.Description, ILV.CodeID, C.DescriptionCode
from
(
    your current query goes here
)  ILV
inner join Codes C on C.CodeID = ILV.CodeID
Random Solutions  
 
programming4us programming4us