Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Help   Contact   Merch   Join   Order   Logon   Forums   
 
Back to Access Forum    Comments List
Upload Images | @Reply | Bookmark | Link | Email | Next Unseen |
Combining Multiple Rows of Information
Erik Emerson 
      
6 hours ago
Is there a way to combine multiple rows of data into one row?  
Here is an example:
A database is setup with tables ArticleT, AuthorT,  and LinkT.  
ArticleT has the title of a book.
AuthorT has the Author's name.
LinkT allows multiped authors to be associated with a title.

A book title "Easy Ways to Dispose of Tribbles and Make Friends" has the authors Spock and Montgomery Scott.

LinkT entry for "Easy Ways to Dispose of Tribbles and Make Friends" has two rows from the AuthorT associated with it (i.e. one for Spock one for Scotty).

This database layout is helpful for data entry, but if you are trying to generate a typical bibliography format (i.e. Author 1 Name, Author 2 Name,... "Title" ...) I start having issues.

I have looked into using crosstab query, but that get messy.
Alkan Toykan  @Reply  
       
2 hours ago
Hi Erik. Your table structure is already correct. I wouldn't change it, and I wouldn't use a crosstab query for this purpose.
A crosstab query is designed to transform rows into columns. That's not really what you're trying to achieve here. You want to take multiple related author records and display their names together in a single field.

What I'd do is start by creating a query joining ArticleT, LinkT, and AuthorT, something along these lines:

SELECT ArticleT.ArticleID, ArticleT.Title, ...
FROM (ArticleT
INNER JOIN LinkT
    ON ArticleT.ArticleID = LinkT.ArticleID)
INNER JOIN AuthorT
    ON LinkT.AuthorID = AuthorT.AuthorID
GROUP BY ...


This gives you the related author records for each article. From there, you can work on combining the author names into a single string.

In other words, keep the normalized relational structure in your tables and handle the concatenation at the query or presentation level.

One thing to keep in mind: if the number of authors varies, you need a method that can concatenate an arbitrary number of related records. Also, if author order matters in your bibliography, consider storing an ordering field in LinkT. The order in which authors are listed can be significant, so relying on alphabetical order or the order in which Access happens to retrieve records isn't a good idea.

The key is that you don't need to pivot your data. You need to aggregate related text values.
Add a Reply Upload an Image
Next Unseen

 
 
What's This?

 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 11/23/2026 5:18:17 AM. PLT: 1s