You are here: Re: Concat tables into one row in view « MsSQL Server « IT news, forums, messages
Re: Concat tables into one row in view

Posted by Erland Sommarskog on 06/26/07 21:19

M@ (mattcushing@gmail.com) writes:
> If I have table1 and table2 with table2 having multiple rows tied to a
> single row in table 1.
>
> What I am trying to do is set up a view that has one row that shows
> the following
> table1.uniqueid, table1.name, table2.row1.detail, table2.row2.detail,
> table2.row3.detail
>
> I'd like to be able to do a select on the view and only come back with
> one row per widget. If possible, I'd actually like to be able to
> concat all the rows from table 2 into one column if that's possible.
>
> table1.uniqueid, table1.name, (table2.row1.detail - table2.row2.detail
> - table2.row3.detail), table1.dateCreated

SQL Server MVP Anith Sen has a couple of methods on
http://www.projectdmx.com/tsql/rowconcatenate.aspx.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

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

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