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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Using LIKE Pattern matching for joining tables

Author  Topic 

vision.v1
Yak Posting Veteran

72 Posts

Posted - 2012-11-12 : 04:56:25
Hi,

I would like to join two tables based on fields of varchar() types

The difference here is that this 'ON' condition will not be a conventional one like this

SELECT * from
TABLE_A as A
inner join TABLE_B as B
on A.Col=B.Col

Instead I want to be a join based on pattern matching

SELECT * from
TABLE_A as A
inner join TABLE_B as B
on A.Col LIKE 'B.Col%'


Please Advise.

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-11-12 : 05:27:32
on A.Col like B.Col + '%'


Too old to Rock'n'Roll too young to die.
Go to Top of Page
   

- Advertisement -