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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reverse the CSV column(One to many relation)

Status
Not open for further replies.

pkohli8

Programmer
Oct 27, 2005
23
US
Hi,
I have this table that contains Names and in other column, I have list of groups that person belongs to in CSV format.
This might be possible that many person can belong to one group.
so, what i am looking for is the reverse of the table. I want to list individual groups in one column and in next column , i want to display all names of person in CSV format that belongs to one group.

For example...Existing table
Name Group
Peter dcs_na_ias_wintel,default,dts_dss_na_prod_wintel
Jhon default,ins chase technology
Mike dcs_na_ias_wintel


Looking for result....

Group Name
dcs_na_ias_wintel Peter,Mike
default Peter,Jhon
dts_dss_na_prod_wintel Peter
ins chase technology Jhon

Thanks In advance
 
I think the problem here is in the way you are storing the data initially. You have the following table:

Name Group
Peter dcs_na_ias_wintel,default,dts_dss_na_prod_wintel
Jhon default,ins chase technology
Mike dcs_na_ias_wintel

How can you find those employees who belong to the group "default"? You'll end up doing a lot of parsing with the way you have it.

I think you should have a table with the following:

Name Group
Peter dcs_na_ias_wintel
Peter default
Peter dts_dss_na_prod_wintel
Jhon default
Jhon ins chase technology
Mike dcs_na_ias_wintel

Maybe someone can help you with doing this with what you have, but I can see problems due to the current design in the future.

Terry
**************************
* General Disclaimer - Please read *
**************************
Please make sure your post is in the CORRECT forum, has a descriptive title, gives as much detail to the problem as possible, and has examples of expected results. This will enable me and others to help you faster...
 
BTW< if I misunderstood, I apologize.

Terry
**************************
* General Disclaimer - Please read *
**************************
Please make sure your post is in the CORRECT forum, has a descriptive title, gives as much detail to the problem as possible, and has examples of expected results. This will enable me and others to help you faster...
 
So, Pkohli, Did we not resolve this issue in thread186-1291312? (This is why it is best to post a question in just one forum.[2thumbsup])

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top