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
 where Column A like Column B

Author  Topic 

infodemers
Posting Yak Master

183 Posts

Posted - 2010-05-03 : 11:47:43
Hi,
Is there a way to run a select query saying where column A like column B?

select from MyTable where COlumn A like Column B

Thanks!

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-05-03 : 12:25:17
its possible

select from MyTable where COlumn A like '%' + Column B + '%'

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

Go to Top of Page

infodemers
Posting Yak Master

183 Posts

Posted - 2010-05-03 : 12:27:01
Hi visakh16,

It works like a charm, Thanks!

quote:
Originally posted by visakh16

its possible

select from MyTable where COlumn A like '%' + Column B + '%'

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

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-05-03 : 12:28:15
welcome

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

Go to Top of Page
   

- Advertisement -