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 2008 Forums
 Transact-SQL (2008)
 Select from table with multiple values

Author  Topic 

ramesh.g
Starting Member

11 Posts

Posted - 2011-08-30 : 03:21:13
Hello,
My query is

SELECT * FROM tblalumni_member WHERE username in (select * from Split('ramesh,sagar,pravin',',')) AND Is_Approved = 1

and username field contain multiple value separated by comma.like ramesh,sachin,pravin.

it shuold give all rows if any of get matched in selected result.
can you please help me asap.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-08-30 : 09:40:04
why this is not working? whats the issue you're facing? i've written a similar parse function which you can try if you want

SELECT * FROM tblalumni_member t
INNER JOIN dbo.ParseValues('ramesh,sagar,pravin',',')f
ON t.username = f.Val
AND t.Is_Approved = 1


Parse values can be found at

http://visakhm.blogspot.com/2010/02/parsing-delimited-string.html

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -