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)
 Like / In

Author  Topic 

lorenz2
Starting Member

2 Posts

Posted - 2008-05-06 : 08:59:00
There is a command called "like" and a command called "in" (a list).

I know how to use this two commands alone. But I need a command which is composed of this two.
An example:

Where
table.column like in (Select column from table)

But this does not work.

Or is there an other possibility for this?
I want to use the "in" command without searching for the exact name but for a name which contains the name.

I hope you understand me. Thank you!

Greats
Lorenz22

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-05-06 : 09:01:17
[code]Select t1.*
from table1 t1 JOIN table2 t2 ON t1.column like '%' + t2.column + '%'[/code]

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

lorenz2
Starting Member

2 Posts

Posted - 2008-05-06 : 09:21:58
thank you, thats exactly that what I need!
Go to Top of Page
   

- Advertisement -