I
In need of assistance
I'm working on grouping individual records together by families, and I need
help creating a text field that is the combination of all records in the
group when the group has more than two records.
My query is below, you can see that I'm using the FIRST and LAST statements
to combine the field when there are only two records, but that clearly will
not work for the groups that have more than two records.
To be clear, I am trying to group merge multiple string fields into one.
The field name is "IndividualType". Any help would be much appreciated.
Data Example:
FamID Fname Lname IdvType
2454 Joan Smith T
2567 Jack Franks T
2454 Bill Smith S
2567 Sue Franks T
2567 Timmy Franks R
Translates Into:
2454 Joan and Bill Smith TS
2567 The Franks Family TTR
Current SQL Query:
SELECT First(
.[FirstName]) & " and " & Last(
.[FirstName]) AS
[Family First],
First(
.[LastName]) AS [Family Last],
First(
.[IndividualType]) & Last(
.[IndividualType]) AS
[FamilyType],
[Matchfield_Fam] AS [Family ID]
FROM
GROUP BY [Matchfield_Fam]
HAVING(Count(*)=2);
UNION SELECT
"The " & First(
.[LastName]) & " Family" AS [Family First],
" " AS [Family Last],
%%%%%%%%%%%% AS [FamilyType],
[Matchfield_Fam] AS [Family ID]
FROM
GROUP BY [Matchfield_Fam]
HAVING(Count(*)>2);
help creating a text field that is the combination of all records in the
group when the group has more than two records.
My query is below, you can see that I'm using the FIRST and LAST statements
to combine the field when there are only two records, but that clearly will
not work for the groups that have more than two records.
To be clear, I am trying to group merge multiple string fields into one.
The field name is "IndividualType". Any help would be much appreciated.
Data Example:
FamID Fname Lname IdvType
2454 Joan Smith T
2567 Jack Franks T
2454 Bill Smith S
2567 Sue Franks T
2567 Timmy Franks R
Translates Into:
2454 Joan and Bill Smith TS
2567 The Franks Family TTR
Current SQL Query:
SELECT First(
[Family First],
First(
First(
[FamilyType],
[Matchfield_Fam] AS [Family ID]
FROM
GROUP BY [Matchfield_Fam]
HAVING(Count(*)=2);
UNION SELECT
"The " & First(
" " AS [Family Last],
%%%%%%%%%%%% AS [FamilyType],
[Matchfield_Fam] AS [Family ID]
FROM
GROUP BY [Matchfield_Fam]
HAVING(Count(*)>2);