Results 1 to 4 of 4
  1. #1
    Minder is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    2

    merge/flatten records

    Hello,
    I have a report with meta tags about several objects. Each instance appears as a separate record. I tried to cross tab this (see screen cap below). I'd like to merge (flatten) these records so each object has one record with meta tags in columns.

    Many thanks



    M. (novice)

    Attachment 14035Click image for larger version. 

Name:	Capture.jpg 
Views:	10 
Size:	96.2 KB 
ID:	14037

  2. #2
    oemar00 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    14
    Would you show the SQL that produce this.
    It looks like the table contains one column value for each ID, if this becoming one record which ID will be displayed?
    Should you fix the table first so that each column will be on the same row?

  3. #3
    Minder is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    2
    Hi Oemar,
    the first column was added by Access when I imported the table. The ID itself is not important, and data loss here is acceptable to combine records. However, the order of the items is important.
    Thanks

    Here's the code:
    TRANSFORM First(Master.[Values]) AS FirstOfValues
    SELECT Master.[ID], Master.[ObjectID], Master.[Description], Master.[Values]
    FROM Master
    GROUP BY Master.[ID], Master.[ObjectID], Master.[Description], Master.[Values]
    PIVOT Master.[Metatag];

  4. #4
    oemar00 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    14
    Quote Originally Posted by Minder View Post
    Hi Oemar,
    the first column was added by Access when I imported the table. The ID itself is not important, and data loss here is acceptable to combine records. However, the order of the items is important.
    Thanks

    Here's the code:
    TRANSFORM First(Master.[Values]) AS FirstOfValues
    SELECT Master.[ID], Master.[ObjectID], Master.[Description], Master.[Values]
    FROM Master
    GROUP BY Master.[ID], Master.[ObjectID], Master.[Description], Master.[Values]
    PIVOT Master.[Metatag];
    To see how the table looks like could you use:
    Code:
    SELECT Master.[ID],
                Master.[ObjectID],
                Master.[Description],
                Master.[Values]
    FROM Master
    ORDER BY 1;


    I think the table is the one that need fixing, the ID data type is Auto number that is why Access keep adding one to it, I see the grouping should be by ObjectID, if that is the case then you need to change the ORDER BY 2 where the sequence will be by ObjectID not ID.

    I think your table results from importing one column at a time, try by importing for all columns at one time which will fix the table as well.

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

Similar Threads

  1. Unique values
    By helpaccess in forum Queries
    Replies: 3
    Last Post: 09-19-2011, 03:46 PM
  2. Duplicate Query Reporting Unique Values...
    By Tomfernandez1 in forum Queries
    Replies: 5
    Last Post: 04-19-2011, 04:22 PM
  3. Creating a unique ID for a new set of values
    By slaterino in forum Programming
    Replies: 1
    Last Post: 08-24-2010, 09:35 AM
  4. Count of Unique Values
    By vsmk in forum Queries
    Replies: 2
    Last Post: 03-14-2010, 12:07 AM
  5. query that will contain all unique records
    By halcolm1 in forum Queries
    Replies: 0
    Last Post: 01-19-2007, 05:34 PM

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