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)
 concatenation of results in a string

Author  Topic 

rdugour@dealogic.nl
Starting Member

1 Post

Posted - 2005-12-27 : 10:02:46
Hello
I'm not sure my problem can be solved using pure SQL:
table:
compID/ compname/ compvalue/ reference
2231 cap 10µF C1
2231 cap 10µF C7
2231 cap 10µF C11
1241 res 1K R12
1241 res 1K R14
1244 res 100E R17

needed result:
compID/ compname/ compvalue/ references/ number
2231 cap 10µF C1,C7,C11 3
1241 res 1K R12,R14 2
1244 res 100E R17 1

The query looks simple enough just a SUM/GROUPBY query, but
the nasty thing is how to concatenate the references to one string

I hope somebody has solved the problem already and is willing to help me out

Thanks a lot

Bye
Robert

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-12-27 : 10:05:34
http://weblogs.sqlteam.com/mladenp/archive/2005/08/01/7421.aspx
point 5

put that code into a User defined function for your example.

Go with the flow & have fun! Else fight the flow
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-12-28 : 01:47:38
Also refer this which uses Function
http://sqljunkies.com/WebLog/amachanic/archive/2004/11/10/5065.aspx?Pending=true


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -