I am trying to join two tables together using a particular field. the code to reproduce is:declare @chris as table(chrisid int identity (1,1) primary key,name varchar(100),SrvStopID int)declare @neal as table(chrisid int identity (1,1) primary key,name varchar(100),SrvStopID int)insert into @Chris select 'John',1 union all select 'Jacob',1 union all select 'Jinglehiemer',1 union all select 'Smith',1insert into @Neal select 'Neal',1 union all select 'SmithSon',1 union all select 'Jones',2select * from @Neal N inner join @Chris C on C.SrvStopID=N.SrvStopID
my result is:chrisid name SrvStopID chrisid name SrvStopID1 Neal 1 1 John 11 Neal 1 2 Jacob 11 Neal 1 3 Jinglehiemer 1 1 Neal 1 4 Smith 12 SmithSon 1 1 John 12 SmithSon 1 2 Jacob 12 SmithSon 1 3 Jinglehiemer 12 SmithSon 1 4 Smith 1and my result should be: Just the results in @Neal that match SrvStopID in @ChrisPlease help me! I have no idea what I am doing wrongThanks so much,Chris