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)
 comma seperated values in a field query

Author  Topic 

ashish908
Starting Member

18 Posts

Posted - 2005-05-07 : 06:22:30
I have a itemmaster field with itemid field as the primary key char(10) field

i have another table say xyz, where there is a column items varchar(50) containing sample data as follows

XYZ table
Items
I000000001
I000000002
I000000001,I000000003

I want the following query
select * from itemmaster where itemid in (select items from xyz)
to return all items having itemcode I000000001,I000000002,I000000003, but what is happening it is returning only items
I000000001,I000000002

Is there a way to write a query to return the results inthe format i want
__________________

cshah1
Constraint Violating Yak Guru

347 Posts

Posted - 2005-05-07 : 07:03:44
here http://www.sqlteam.com/searchresults.asp?SearchTerms=csv
or you should normalize your database so fields are intended to have only one value
Go to Top of Page
   

- Advertisement -