SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Select statement within "like" query
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

kalyan.cse05
Yak Posting Veteran

India
74 Posts

Posted - 04/17/2013 :  06:49:25  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

Pakistan
1054 Posts

Posted - 04/17/2013 :  07:08:38  Show Profile  Reply with Quote
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

Edited by - MIK_2008 on 04/17/2013 07:10:41
Go to Top of Page

Robowski
Posting Yak Master

101 Posts

Posted - 04/17/2013 :  07:24:44  Show Profile  Reply with Quote

SELECT
*
FROM
table1 a (nolock)
INNER JOIN
table2 b (nolock) ON a.name LIKE '%'+b.name+'%'
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000