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)
 Query

Author  Topic 

lane0618
Posting Yak Master

134 Posts

Posted - 2004-06-16 : 19:51:51
I have the following table:

item--desc1---desc2
123-1,A,C
123-2,B,A
345-1,A,D
345-2,A,A

I want to end up with:
item--desc1---desc2
123,(AB),(CA)
345,(A),(CAD)

so that 123-1 and 123-2 are grouped together and all the values in the desc1 and desc2 field are consolidated into one field. Hope that makes sense. Thanks!

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2004-06-16 : 20:00:15
Is there any limit to the number of 'descriptions' per item?

Also - how do you get (A),(CAD) from A,D and A,A?

Go to Top of Page

lane0618
Posting Yak Master

134 Posts

Posted - 2004-06-16 : 20:11:48
Oops, should be:
item--desc1---desc2
123,(AB),(CA)
345,(A),(DA)

So for example, If I look just at item and desc1 for 123-1 and 123-2 which are grouped into 123, it looks like this:
item--desc1
123-1,A
123-2,B

equals:
item--desc1Total
123,(AB)

So 123 has a consoldated desc1 of A+B (or formatted like (AB))
Once again, hope this makes some sense...


Go to Top of Page
   

- Advertisement -