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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Help with a query !
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sqlilliterate
Starting Member

40 Posts

Posted - 09/26/2008 :  03:26:34  Show Profile  Reply with Quote
help me in writing a query...

I need to find the particular values from the below list which contains the numbers --> 10, 20, 30

My column values...
Production Supervisor - WC10
Production Supervisor - WC20
Production Supervisor - WC30
Production Supervisor - WC40
Production Supervisor - WC45
Production Supervisor - WC50
Production Supervisor - WC60
Production Technician - WC10
Production Technician - WC20
Production Technician - WC30
Production Technician - WC40
Production Technician - WC45
Production Technician - WC50
Production Technician - WC60

But my like condn values (i.e. 10,20,30) comes as a result set from another table.

help me with a query like this...
(this qry won't work since the subquery results more than 1 row)

select * from <table> where <column> like
(select no from <table2>)


Thanks in advance...









visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 09/26/2008 :  03:28:56  Show Profile  Reply with Quote
may be this
select t.* from <table> t
inner join <table2> t2
on t.<column> like '%' + t2.no + '%'
Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22772 Posts

Posted - 09/26/2008 :  03:30:47  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
select t1.* from table1 as t1 inner join table2 as t2 on t1.col like '%'+t2.no


Madhivanan

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

madhivanan
Premature Yak Congratulator

India
22772 Posts

Posted - 09/26/2008 :  03:31:40  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote


Madhivanan

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

sqlilliterate
Starting Member

40 Posts

Posted - 09/26/2008 :  06:21:19  Show Profile  Reply with Quote
Thanks v much Vishak n madhi...

It worked :)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 09/26/2008 :  06:22:25  Show Profile  Reply with Quote
quote:
Originally posted by sqlilliterate

Thanks v much Vishak n madhi...

It worked :)


you're welcome
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.08 seconds. Powered By: Snitz Forums 2000