Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 reference separate descriptions column

Author  Topic 

eevans
Starting Member

48 Posts

Posted - 2009-03-11 : 08:19:24
Hello,
I am working with columns whose values are abbreviations. The abbreviations' full names are located in a separate View which acts as a key (i.e. the abbreviations are in a column beside another column listing their full names).

How do I write a SELECT statement to pull the abbreviation columns but return the full name of the abbreviation in the results?

This is incorrect syntax but gives the just of what I'm trying to do.

SELECT cust_id,
interest_1 (REFERNCE interest_description FROM interest_view),
interest_2 (REFERENCE interest_description FROM interest_view),
interest_3 (REFERENCE interest_description FROM interest_view)

FROM customer_master

Thanks!

darkdusky
Aged Yak Warrior

591 Posts

Posted - 2009-03-11 : 08:28:32
SELECT cust_id, interest_view.interest_description
FROM customer_master
JOIN
interest_view
ON
customer_master.abreviation=interest_view.abreviation
Go to Top of Page

eevans
Starting Member

48 Posts

Posted - 2009-03-11 : 08:36:59
Thanks!
Go to Top of Page

darkdusky
Aged Yak Warrior

591 Posts

Posted - 2009-03-11 : 08:50:59
welcome
Go to Top of Page
   

- Advertisement -