sql server - SQL Multiple Joins -


given following 2 tables:

create table [dbo].[mtcorrelations] (     [correlationid] [int] identity(1,1) not null,     [stocka] [nvarchar](5) not null,     [stockb] [nvarchar](5) not null,     [correlation] [float] not null,     [lengthstr] [nvarchar](5) not null,     [date] [datetime] not null )  create table [dbo].[industries] (     [industryid] [int] identity(1,1) not null,     [symbol] [nvarchar](5) not null,     [sector] [nvarchar](50) null,     [industry] [nvarchar](50) null ) 

i trying industries of stocka , stockb industries table. don't know how multiple joins. best can come with:

select top 1000  [correlationid]        ,[stocka]       ,[stockb]       ,[correlation]       ,b.industry       ,c.industry   [markettopology].[dbo].[mtcorrelations] join [markettopology].[dbo].[industries] b on a.stocka = b.symbol   , join [markettopology].[dbo].[industries] c on a.stockb = c.symbol 

i error on and. what's correct way of doing this?

remove and a , have next join

select top 1000             [correlationid],           [stocka],           [stockb],           [correlation],           b.industry,           c.industry      [markettopology].[dbo].[mtcorrelations]   join [markettopology].[dbo].[industries] b      on a.stocka = b.symbol    join [markettopology].[dbo].[industries] c      on a.stockb = c.symbol 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -