Advertisement

05.07.2008 at 07:29PM PDT, ID: 23384895
[x]
Attachment Details

Using LIKE Pattern matching for joining tables

Asked by justin_smith in SQL Server 2005, SQL Query Syntax

Tags: Microsoft, SQL Server, 2000, T-SQL

Hi Experts,

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%'

I count do a substring on one of the columns if it has a consistency across..
But this is not possible...


Does any have any any ideas to use a LIKE pattern matching to join my two tables..
Or any other options to get the same results

Thanks in Advance

Theepan

Start Free Trial
[+][-]05.07.2008 at 07:31PM PDT, ID: 21521925

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: SQL Server 2005, SQL Query Syntax
Tags: Microsoft, SQL Server, 2000, T-SQL
Sign Up Now!
Solution Provided By: Thomasian
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628