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
 General SQL Server Forums
 New to SQL Server Programming
 Correct Join to Use in a view?

Author  Topic 

keithmg
Starting Member

2 Posts

Posted - 2011-03-23 : 13:24:25
Hi
This is a fairly basic question Id appreciate any help with :-)

I have 2 tables

The ID column has FK for each of the config columns.

ConfigTable
ID int
Description nvarchar(200)

DataTable
Config1 int
config2 int
config3 int

My new view of the Data table would be
DescritpionConfig1|DescritpionConfig2|DescritpionConfig3

I want each config* value to show the description value instead of the int from the config table.

I have been working with some of the joins but I can only get one of the values to display as a description and cant figure out how to get the rest to display correctly(Inner Join)

Thanks in advance

revdnrdy
Posting Yak Master

220 Posts

Posted - 2011-03-23 : 13:28:24
Hello;

This seems simple enough but could you post your code so that we may examine it? You may only need a small adjustment to get it working!

r&r
Go to Top of Page

keithmg
Starting Member

2 Posts

Posted - 2011-03-23 : 14:42:30
I dont know what the Select should really contain

I want mutliple descriptions to be displayed, in each config* column.. Below is totally wrong and does nothing, but just to give you an idea what Im doing!

SELECT dbo.ConfigTable.Description, dbo.DataTable.Id
FROM dbo.ConfigTable INNER JOIN
dbo.DataTable ON dbo.ConfigTable.Id = dbo.DataTable.Config1 AND
dbo.ConfigTable.Id = dbo.DataTable.Config3 AND
dbo.ConfigTable.Id = dbo.DataTable.Config2
Go to Top of Page
   

- Advertisement -