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 2008 Forums
 Transact-SQL (2008)
 Sql join with partial field

Author  Topic 

Ozzie6935
Starting Member

1 Post

Posted - 2012-06-04 : 20:03:33
Hello gurus
I need to make a join where one column is equal to part of another column after period (.), its sql 2008

Column_1
Chair
Table
sofa

====

Column_2
whatever.Chair
something.sofa
However.table


so column_1 = column_2 but only after period,

can it be done?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-06-04 : 21:32:13
[code]
....
FROM table1 t1
INNER JOIN table2 t2
ON t2.Column_2 LIKE '%.' + t1.Column_1
[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2012-06-05 : 05:27:53
Are the columns part of same table? Then you dont need a join

Madhivanan

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

- Advertisement -