You are here: Return subquery rows as one delimited column « MsSQL Server « IT news, forums, messages
Return subquery rows as one delimited column

Posted by kingskippus on 10/25/06 21:40

I don't know if this is possible, but I haven't been able to find any
information.

I have two tables, for example:

Table 1 (two columns, id and foo)
id foo
--- -----
1 foo_a
2 foo_b
3 foo_c

Table 2 (two columns, t1_id, and bar)
t1_id bar
------ ----
1 bar_a
1 bar_b
1 bar_c
2 bar_d
3 bar_e
3 bar_f

What I'm shooting for is returning the result of a subquery as a
text-delimited column. In this example, using a comma as the
delimiter:

Recordset Returned:
foo bars
----- -----
foo_a bar_a,bar_b,bar_c
foo_b bar_d
foo_c bar_e,bar_f

I know that it's usually pretty trivial within the code that is
querying the database, but I'm wondering if the database itself can do
this.

Is this possible, and if so, can someone please point me to how it can
be done?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация