Results 1 to 3 of 3
  1. #1
    digit is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Mar 2019
    Posts
    1

    Same ID in a row

    Hi i have table like this :
    ID SIZE 1 SIZE 2 SIZE 3 SIZE 4
    1 12 14 16 18
    2 12 16
    3 14
    4
    5 10 12
    I need to be like this :


    ID SIZE
    1 12
    1 14
    1 16
    1 18
    2 12
    2 16
    3 14
    4
    5 10
    5 12

    I know that this is very easy but im new. Can you help me.

  2. #2
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Here is one way:
    Create the table structure of your new table (with two fields).
    Then, create 4 append queries, to write the table from your original table to your new table.
    The first one would write ID and Size 1 field to the new table.
    The second one would write ID and Size 2 field to the new table
    etc, etc

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Use a UNION query to rearrange data to normalized structure.

    SELECT ID, Size1 AS Size FROM tablename
    UNION SELECT ID, Size2 FROM tablename
    UNION SELECT ID, Size3 FROM tablename
    UNION SELECT ID, Size4 FROM tablename;

    Then use that query in other queries, even a MAKE TABLE or INSERT.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

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