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
 Express Edition and Compact Edition (2005)
 Query Help

Author  Topic 

vree
Starting Member

30 Posts

Posted - 2006-08-15 : 10:28:41
I have a query which returns one row for each committe a person is on.ie: there are 3 entries for J. Smith if he particpates in 3 committees.

I want to know how to get one name and multiple committees? I previously handled the grouping at the report level. Is there any way to do this?

SELECT DISTINCT
dbo.tblCommittee.Committee,
dbo.tblMemberCompany.CompanyName,
dbo.tblContact.FirstName, dbo.tblContact.MiddleName,
dbo.tblContact.LastName
FROM dbo.tblCommittee LEFT OUTER JOIN
dbo.tblCommitteeMember INNER JOIN
dbo.tblMemberCompany INNER JOIN
dbo.tblMemberContact ON
dbo.tblMemberCompany.MemberID = dbo.tblMemberContact.MemberId
INNER JOIN
dbo.tblContact ON
dbo.tblMemberContact.ContactId = dbo.tblContact.ContactID ON
dbo.tblCommitteeMember.MemberContID = dbo.tblMemberContact.MemberContId
ON
dbo.tblCommittee.CommitteeID = dbo.tblCommitteeMember.CommitteeID
WHERE (dbo.tblMemberCompany.CompanyName = 'Some Company')

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-08-15 : 10:57:57
Post some sample data and expected results.
Also note that it is much better to do formatting, ... in Client Side (ie. Report or Display), than writing head-cracking T-SQL code.


Srinika
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-08-15 : 10:59:47
Can you post some sample data and the result you want?

Madhivanan

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

- Advertisement -