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
 Select statement within "like" query

Author  Topic 

kalyan.cse05
Yak Posting Veteran

74 Posts

Posted - 2013-04-17 : 06:49:25
Is it possible to write select clause within like statement.
Ex :
Select * from TableA
where Name like 'Select Name from TableB'
Plz help!

kalyan Ashis Dey

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2013-04-17 : 07:08:38
Yes only if the select (for like) statement returns one value , else it would throw an error

And also the statment should be without single qoutues e.g.

Like (select columnName from Table)


Cheers
MIK
Go to Top of Page

Robowski
Posting Yak Master

101 Posts

Posted - 2013-04-17 : 07:24:44

SELECT
*
FROM
table1 a (nolock)
INNER JOIN
table2 b (nolock) ON a.name LIKE '%'+b.name+'%'
Go to Top of Page
   

- Advertisement -