A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Concatenate multiple records



 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old March 3rd, 2010, 11:43 PM posted to microsoft.public.access.queries
QB
external usenet poster
 
Posts: 150
Default Concatenate multiple records

I have a table to enter contact information where each contact is assigned a
random id no. That said it is possible to also associate a Family id no so
you can link members of the same family together. I now need to pull a
singular list by family id with the relevant info combining multiple records
together and am lost on the how-to do it.

Basic Table Structure
Table Name: C1
Table Fields: ID, M_MNBR, M_TITLE, M_LNAME, M_FNAME, C_NAME, M_ADDR, ...

The ID is the PK and the M_MNBR is the family id.

I need to pull the a list
C_NAME, M_TITLE, M_FNAME, M_LNAME, M_ADDR, ...
but, and you knew there'd be a twist. I need to always group by the Title =
"Mr".

Therefore, if in a given family there is an entry for Mr John Smith and
another for Mrs Joan Smith I need it to return a concatenated C_Name Mr John
Smith and Mrs Joan Smith and then the rest of the data pertaining to only Mr
John Smith.

If in the case there is no Mr, then give the Mrs info, and vice-versa.

A concrete example
ID, M_MNBR, M_TITLE, M_LNAME, M_FNAME, C_NAME, M_ADDR, ...
1, 10001, Mr, Smith, John, Mr John Smith,...
2, 13092, Mrs, Libeler, Lilian, Mrs Lilian Libeler,...
3, 14560, Dr, Krawl, David, Dr David Krawl,...
4, 10001, Mrs, Smith, Gwen, Mrs Gwen Smith,...

The query would return
Mr John Smith and Mrs Gwen Smith, Mr, Smith, John, ...
Mrs Lilian Libeler, Mrs, Libeler, Lilian, ...
Dr David Krawl, Dr, Krawl, David, ...

Can this be done and how?

Thank you for the help,

QB
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:06 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.