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 2000 Forums
 SQL Server Development (2000)
 query of a query problem

Author  Topic 

zubair
Yak Posting Veteran

67 Posts

Posted - 2004-07-22 : 09:49:38
Hi i have the following query which works fine. The subquery returns me 2 values

Bunting
Window Cling

now what i want is to do in the first query a LIKE instead of an IN.
At the moment using the IN works fine, but when i substitute it with a LIKE i get an error.

I've pasted my code below. Can anyone help? Thanks


select * from csa.dbo.elementlookup
where element in

(
SELECT CSA.dbo.ElementLookup.Element
FROM creativeBOM INNER JOIN
CSA.dbo.ElementLookup ON creativeBOM.elementId = CSA.dbo.ElementLookup.ElementID
WHERE creativeBOM.filmId = 5162 AND creativeBOM.countryId = 362
)

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-07-22 : 09:54:57
LIKE only works with single values and must have a wildcard in it somewhere to work. Why don't you explain what you are trying to achieve like this? Do you want things spelled similarly? Do you want things that are similar sounding? Do you want it where the first part of the string is similar? Give us some sample data and show us what you are trying to achieve.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page
   

- Advertisement -