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 on grouping, or Using a sub query as column value

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-03-18 : 18:39:10
Mathieu writes "Heres a real curve ball,

I am trying to create a comma separated list of values that would appear in the field of one of my SQL Views.

I have a Parent table and a Childs table with a "1-to-Many" relationship. In the view that returns the list of parents I would like a column containing all the childs "name" separated by a coma and a space.

Something like this
| UID  | name    | childs
------------------------------------------
| 0001 | ParentA | child1, child2, child3
| 0002 | ParentB | child4, child5, child6
| 0003 | ParentC | child7, child8, child9



- Can this be done without a stored procedure ?
- If not, what would be most efficient way to use a stored procedure ?
- And if its not possible... why????

Thanks a lot!


P.S.: I've been searching for about 4 months... and I found nothing and nobody knows!!!"
   

- Advertisement -