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 2005 Forums
 Transact-SQL (2005)
 Data extraction problem

Author  Topic 

DocLove
Starting Member

1 Post

Posted - 2010-08-05 : 22:05:19
I need to take data from 3 tables and combine them, this normally would not be an issue, but here is what I am trying to do and have lost my mind, I am sure it is simple but I cannot figure it out.

The first table contains a list of projects, with an ID field and info about the project.
The Second table contains a list of people working on projects, with an ID and name Field
The Third is a Linked list that shows who is working on what projects.

The rub is that many people can work on one project. I am trying to make a query to drive a report that will show the project info and a list of people working on it with line feeds after each name, this way the output is formatted for insertion into the report.

Thank You for your time
The Doc.

kenchee
Starting Member

49 Posts

Posted - 2010-08-05 : 22:52:15
Hi,
Are you looking for an result of something like this?
Project_info
person_name1
person_name2

Project_info2
person_name3
person_name4

???
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-08-09 : 05:07:23
You should do this in your reporting tool. Just group by Id columns

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2010-08-09 : 07:47:15
A line feed can be created like this:

print 'a' + char(13) + char(10) + 'b'

- Lumbago

My blog (yes, I have a blog now! just not that much content yet)
-> www.thefirstsql.com
Go to Top of Page
   

- Advertisement -