Once written and tested, invoke the function as part of a query. see snippet
Main Topics
Browse All TopicsHi,
I have two tables. [TblProject] is set up with the following fields:
ProjectID (AutoNumber)
ProjectName (Text)
ActiveProject (Yes/No)
and this table has a one to many relationship with a table called [TblPersonnel] which has the following:
PersonnelID (AutoNumber)
ProjectID (Relation to TblProject - ProjectID)
PersonnelName (Text)
I want to run a SQL query which shows each record in TblProject once and if there are multiple entries in TblPersonnel then have them concentated into one field. Or put another way, instead of the query showing
[ProjectID] [ProjectName] [ActiveProject] [Personnel]
1 Name A Yes Personnel 1
1 Name A Yes Personnel 2
1 Name A Yes Personnel 3
2 Name B No Personnel 2
To be shown as:
[ProjectID] [ProjectName] [ActiveProject] [Personnel]
1 Name A Yes Personnel 1, Personnel 2, Personnel 3
2 Name B No Personnel 2
Sorry, I know next to nothing about writing SQL queries so any help will be much appreciated
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hey... thanks so much for having a look at this. It looks like exactly what I was wanting but having tried to implement it i have realised that I made a small mistake. [TblProject] and [TblPersonnel] actually don't have a one-to-many relationship. They have a many-to-many relationship. There is a table in between them called [TblProjectPersonnelJoin].
Any ideas?
Business Accounts
Answer for Membership
by: aikimarkPosted on 2009-09-28 at 09:29:18ID: 25440733
Is there a reasonable limit to the number of people within a project? That is, can you state some number for which there will never be more people on a project than that number?
I think the easiest thing is to create a public function to do this concatenation. You pass the projectID to the function and the function returns the concatenated personnel as a string.
Example:
Select allOpen in new window