Results 1 to 3 of 3
  1. #1
    kb3zq is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2016
    Posts
    1

    Merging fields in one row into another row


    I have a set of data listing Employee SSN, Employee Name, Dependent SSN, Dependent Name.
    There is a separate row for each dependent an employee has.
    I need to identify each duplicate Employee SSN and put all Dependent information in just one row.

    Example:
    The tables I am using are set up in this manner.
    Employee SSN l Employee Name l Dependent SSN l Dependent Name
    123456789 l John Smith l 456456456 l Jane Smith
    123456789 l John Smith l 789789789 l Greg Smith

    I need to know how to set up a query that will give the following results:
    Employee SSN l Employee Name l Dependent1 SSN l Dependent1 Name l Dependent2 SSN l Dependent2 Name
    123456789 l John Smith l 456456456 l Jane Smith l 789789789 l Greg Smith

    Thanks.

  2. #2
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,929
    suggest you take a look at the concatrelated function and adapt to your needs
    http://allenbrowne.com/func-concat.html

    alternatively you need an additional column to indicate whether the dependent is 1st, 2nd, 3rd etc

    and use two crosstab queries joined together

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    kb3zq,

    Why is this output format required?

    Since you are dealing with Employees, your application may need more info about each Employee.
    If that is the case, you may want to consider this table structure.

    Employee------>Dependent

    where an Employee may have 0,1, or many dependents.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 11-27-2015, 03:28 PM
  2. merging fields
    By Jen0dorf in forum Access
    Replies: 9
    Last Post: 08-23-2015, 01:47 PM
  3. Merging fields in a table
    By Bx Snipe in forum Access
    Replies: 1
    Last Post: 09-24-2012, 01:45 PM
  4. Replies: 5
    Last Post: 07-28-2011, 08:34 AM
  5. merging two fields
    By brandon in forum Access
    Replies: 5
    Last Post: 06-09-2010, 08:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums