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.
Author |
Topic |
boyfriendalex
Starting Member
15 Posts |
Posted - 2008-07-22 : 01:53:02
|
Hi.I want the following result: table1 table2No, Name, NO Subject1 leehong 1 math2 tanzo 1 com3 alex 2 biology 2 business 3 marketingresult: 1 leehong math,com 2 tanzo biology,business 3 alex marketingi did it already in sql2005 select name,(select STUFF((select ',' + t2.subject AS [text()] from table2 t2 where t2.no = t1.no ) ,1,2,'')) AS labelbut it doesn't work in sql2000Anyone help? |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
boyfriendalex
Starting Member
15 Posts |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-07-22 : 02:49:38
|
take a look at the link i posted KH[spoiler]Time is always against us[/spoiler] |
 |
|
boyfriendalex
Starting Member
15 Posts |
Posted - 2008-07-22 : 02:58:10
|
quote: Originally posted by khtan take a look at the link i posted KH[spoiler]Time is always against us[/spoiler]
that is in sql2000,isn't it?you see the following code: SELECT t.BOMID,( SELECT STUFF( (SELECT ', ' + t1.ITEMNAME AS [ text() ] FROM #TempList8 t1 WHERE t1.BOMID COLLATE DATABASE_DEFAULT = t.BOMID COLLATE DATABASE_DEFAULT ORDER BY t1.BOMID FOR XML PATH('')),1,2,'')) AS LABELwhat part is incorrent? |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-07-22 : 03:00:48
|
SQL 2000 does not support the FOR XML PATH KH[spoiler]Time is always against us[/spoiler] |
 |
|
boyfriendalex
Starting Member
15 Posts |
Posted - 2008-07-22 : 03:04:36
|
quote: Originally posted by khtan SQL 2000 does not support the FOR XML PATH KH[spoiler]Time is always against us[/spoiler]
yeah, it seems like that i think so, what is the solution for this? |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
|
|
|
|