You are here: Re: Multiple rows into one row « MsSQL Server « IT news, forums, messages
Re: Multiple rows into one row

Posted by David Portas on 01/17/07 22:24

Chicagoboy27 wrote:
> Hello I am wondering if this is possible.
>
> I have a two tables one contains Plan information and another that
> contains product information about the plan
>
> ex:
> Plan table
> PlanID Plan_name
> 1 a
> 2 b
>
> Product Table
> ProductID PlanID Comments
> 1 1 com1
> 2 1 com2
> 3 1 com3
>
> What I am looking to do if possible would be the following
>
> Plan Product1 Comments1 Product2 Comments2
> 1 1 com1 2 com2
>
>
> I am wondering down what path I should explore cause I am new to this.
> I am using sql 2005

Take a look at PIVOT in Books Online. Also Itzik Ben-Gan has articles
on PIVOT in the last two issues of SQL Server Magazine. www.sqlmag.com

--
David Portas, SQL Server MVP

Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.

SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--

 

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

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