473,321 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Multiple rows into one row

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

Jan 17 '07 #1
2 2950
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/m...S,SQL.90).aspx
--

Jan 17 '07 #2
Thanks I will explore that option...

David Portas wrote:
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/m...S,SQL.90).aspx
--
Jan 17 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Steven An | last post by:
Howdy, I need to write an update query with multiple aggregate functions. Here is an example: UPDATE t SET t.a = ( select avg(f.q) from dbo.foo f where f.p = t.y ), t.b = ( select sum(f.q)...
4
by: Dave Edwards | last post by:
I understand that I can fill a datagrid with multiple queries, but I cannot figure out how to fill a dataset with the same query but run against multiple SQL servers, the query , table structure...
20
by: p175 | last post by:
Hi people, I have a stored procedure that creates many Global temporary session tables. Into each of these tables go the results of various processing using relational division all keyed and...
9
by: TC | last post by:
I need to design a system which represents multiple "projects" in SQL Server. Each project has the same data model, but is independent of all others. My inclination is to use one database to store...
3
by: =?Utf-8?B?S2F5xLFoYW4=?= | last post by:
In my project,i added datagridview to my form , i transfered my table to datagridview and added multiple rows and when i called dataadapther.update ,,result is ok. But when i tried it for the...
2
by: Michael | last post by:
It seems that a gridview allows us to delete only a single row at a time. How to extend this functionality to select multiple rows and delete all of the selected rows in a single stroke? just like...
3
by: nigelesquire | last post by:
Please help! I'm trying to clone and delete multiple rows with JavaScript. I need two delete buttons that work...! I only have one for now, but it's not working properly, the output count is...
92
by: bonneylake | last post by:
Hey Everyone, Well i was hoping someone could explain the best way i could go about this. i have a few ideas on how i could go about this but i am just not sure if it would work. Right now i...
58
by: bonneylake | last post by:
Hey Everyone, Well recently i been inserting multiple fields for a section in my form called "serial". Well now i am trying to insert multiple fields for the not only the serial section but also...
482
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if this is more of a coldfusion problem or a javscript problem. So if i asked my question in the wrong section let me know an all move it to the correct place. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.