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
 Join?

Author  Topic 

raysefo
Constraint Violating Yak Guru

260 Posts

Posted - 2010-10-07 : 09:25:25
Hi,

I have two tables.In table A, there is a field NAMES which contains jack,john,james. And in table B there is a field NAME which contains jack.

Is there a way to join two tables according to those fields?

thanks in advance.

Best Regards

jafrywilson
Constraint Violating Yak Guru

379 Posts

Posted - 2010-10-07 : 10:38:02
create alias for the table and make join using that
Table A m
INNER JOIN Table B AS t1 ON t1.Name = m.Names
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-10-07 : 11:13:30
select *
from tableb as b
inner join tablea as a on ',' + a.names + ',' like '%,' + b.name + ',%'



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-10-08 : 06:07:35
quote:
Originally posted by raysefo

Hi,

I have two tables.In table A, there is a field NAMES which contains jack,john,james. And in table B there is a field NAME which contains jack.

Is there a way to join two tables according to those fields?

thanks in advance.

Best Regards


Also read about Normalisation

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -