Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query - Comma list to rows

Status
Not open for further replies.

mdiaz1328

Technical User
Jan 9, 2012
7
US
I cannot seem to find the solution to this, your help would be veru much appriciated.

I need to create a query that takes a column containg a comma delimited list and produces rows for each value...

For example.

Table A

Item_Name Item_Number Item_List
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Item1 1000 “W,X,Y,Z”
Item2 2000 “W,X,Y,Z”
Item3 3000 “W,X,Y,Z”




Here is what I would like for results:

Item_Name Item_Number Item_List Item_Value
Item1 1000 “W,X,Y,Z” W
Item1 1000 “W,X,Y,Z” X
Item1 1000 “W,X,Y,Z” Y
Item1 1000 “W,X,Y,Z” Z
Item2 2000 “W,X,Y,Z” W
Item2 2000 “W,X,Y,Z” X
Item2 2000 “W,X,Y,Z” Y
Item2 2000 “W,X,Y,Z” Z
Item3 3000 “W,X,Y,Z” W
Item3 3000 “W,X,Y,Z” X
Item3 3000 “W,X,Y,Z” Y
Item3 3000 “W,X,Y,Z” Z

How can I accomplish this ?

Thanx again !
 
MDiaz,

Are there a fixed number of items in your ITEM_LIST, or is the number variable?

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
“People may forget what you say, but they will never forget how you made them feel.
 
Sorry, I probably should have mentioned that. The length (number of values) of the list is NOT fixed.

-Mario-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top