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.
| Author |
Topic |
|
MariaM
Starting Member
17 Posts |
Posted - 2002-08-14 : 07:26:34
|
| Hi,A beginner question: I have two tables TableA and TableB that looks like this:TableACountryA CountryB1 12 13 2TableBCountryCode CountryText1 Sweden2 Denmark3 NorwayCountryCode is primary key for TableB. Both the CountryA and CountryB columns are related to the CountryCode in tableB (foreign keys).If I want to create a select statement that prints the CountryText instead of the Codes for the CountryA and CountryB in TableA, how do I do this ? Is it possible or do I have to create two lookup tables ? Thanks in advance !/Maria |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2002-08-14 : 07:36:21
|
| select CountryA = b1.CountryText, CountryB = b2.CountryTextfrom TableA a, TableB b1, TableB b2where a.CountryA = b1.CountryCodeand a.CountryB = b2.CountryCode==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|