I am currently struggling with a particularly nasty old DB schema and query set, if anyone can help with resolving the below problem i would be very grateful. The example below is a simplified (Non real) version of the problem.
Essentially i have two tables (both fairly normalized) which need to be joined in a particular manner:
table 1: People
PID Name
1 Peter
2 John
3 Dave
Table 2: Clothing
PID Item_name
1 Gloves
1 Hat
1 Overcoat
2 Socks
3 scarf
2 shoes
The end result needs to look like the following:
Name PID Clothing
Peter 1 Gloves, Hat, Overcoat
John 2 Socks, shoes
Dave 3 Scarf
Although the join is easy, the concatenation of the strings (clothing) is the part with which i am struggling (BTW I'm not worried about the comma separator, as long as there is any separator i can work with it). The clothing table may have 0 up to infinity records in it per person.
I know that there is a solution in Sybase (the LIST function) but i am stuck with ORACLE.
Once again my thanks in advance
Peter Delpy
Essentially i have two tables (both fairly normalized) which need to be joined in a particular manner:
table 1: People
PID Name
1 Peter
2 John
3 Dave
Table 2: Clothing
PID Item_name
1 Gloves
1 Hat
1 Overcoat
2 Socks
3 scarf
2 shoes
The end result needs to look like the following:
Name PID Clothing
Peter 1 Gloves, Hat, Overcoat
John 2 Socks, shoes
Dave 3 Scarf
Although the join is easy, the concatenation of the strings (clothing) is the part with which i am struggling (BTW I'm not worried about the comma separator, as long as there is any separator i can work with it). The clothing table may have 0 up to infinity records in it per person.
I know that there is a solution in Sybase (the LIST function) but i am stuck with ORACLE.
Once again my thanks in advance
Peter Delpy