Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2009
    Posts
    47

    Unanswered: Shift data from columns

    I am trying to pull data from Right 4 columns and shift it to the left.

    col1-col2-col3-col4-col5-col6
    12==31==13==42==345==543
    32==12==12==22==230==132

    Now that output should look something like

    col1-col2-col3-col4-col5
    31==13==42==345==543
    12==12==22==230==132

    NOTICE ! I want the column Headings or names to change col2 becomes col1
    and so on ..

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Where do you want this to happen, in a table, in a query, on a form or a report? And what happens to the former col1 in case it's in a table you want to perform this?

    Have a nice day!

  3. #3
    Join Date
    Feb 2009
    Posts
    47
    This happens from a table. I had a previous Make table querry that gave an output table and now i have to shift this data from that output table. So the query will be looking at a Table. Col1 needs to stay as a aprt of the orignal table, but not included in the output of this query that i am trying to do.
    Later I will take the data that was in Col2 which would be now COL1 and combine it to the orignal Table so the COL1 data new and old gets combined.Well at least I think it might work.

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    1) If the output has to be a query, you can write something like this:

    Code:
    SELECT Col2 AS Col1, Col3 AS Col2, ...
    FROM OriginalTable;
    2) If you want to import the data into another table that already exists, then:

    Code:
    INSERT INTO AnotherTable (Col1, Col2, ...)
    SELECT Col2, Col3, ...
    FROM OriginalTable;
    3) If you want to import the data into a new table , then:
    Code:
    SELECT Col2 AS Col1, Col3 AS Col2, ... 
    INTO NewTable
    From OriginalTable;
    Have a nice day!

  5. #5
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Nice work Sinndho
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  6. #6
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Thanks StarTrekker!

  7. #7
    Join Date
    Feb 2009
    Posts
    47

    Problem Solved

    Thanks man that really helped.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •