September 20, 2005 at 8:40 am
Hi
I want to search text in this way:
USE Northwind
SELECT * FROM employees WHERE firstname like '%' + (SELECT Distinct
LEFT(ContactName,3) FROM customers WHERE LEFT(ContactName,2) = 'AN') + '%'
--
but I get error msg:
Subquery returned more than 1 value. This is not permitted when the subquery
follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
So i got that LIKE is for string is there a way to search with Subquery???
September 20, 2005 at 8:44 am
Something like this?
Select col1, col2 from dbo.Employees E inner join dbo.Customers C on E.FirstName like '%' + LEFT(C.ContactName, 3) + '%' and LEFT(C.ContactName, 3) = 'AN'
September 20, 2005 at 1:54 pm
Very Good! ... just a minor slip
Select col1, col2 from dbo.Employees E inner join dbo.Customers C on E.FirstName like '%' + LEFT(C.ContactName, 3) + '%' and LEFT(C.ContactName, 2) = 'AN'
* Noel
September 20, 2005 at 1:57 pm
Just wanted to see if you guys were paying attention .
September 21, 2005 at 2:00 am
Thanks
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply