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 problem

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-02-22 : 07:35:39
avats writes "hi
i need urgent help in building a query

i want to search records in one table from the values returned by a aubquery using the like operator or pattern matching
eg. if subquery returns 91 then main query should return all strings starting from 91, if subquery return 911 then main query should return all values starting with 911
values returned by subquery as well as by the mainquery are of varchar type.
subquery will return around 3000 rows and main query table will be having around 1 lakh records to search from
i'll wait for answer
bye
avats(just joined the sqlteam forum)"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-02-22 : 07:54:24
Try this

select * from Table1 T
where field like (select filed from table2 where filed=T.filed)



Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -