Results 1 to 10 of 10
  1. #1
    Join Date
    Sep 2014
    Posts
    7

    Unanswered: query to update mulitple records in 1 short

    Hello,

    We are using ERP where we have almost 20000 Items.

    Not we are in phase of cleaning Item Master and want to update some of the records.

    For example

    Item Code Item Group TO UPDATE
    A A1 R1
    B A1 A1
    C R1 S1
    D S1 A1
    E E1 T1
    F T1 R1
    G A1 S1

    Now how i will update this.

    Please write a query for me

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I'm afraid your question, as it is currently written, is unclear.

    Please provide:
    - Your table definition(s) [CREATE TABLE...]
    - Some sample data
    - Desired output [how should it look once complete]
    - An explanation as to why the records change the way they do to reach that end result
    George
    Home | Blog

  3. #3
    Join Date
    Sep 2014
    Posts
    7
    Hi,

    ITEM CODE(COLUMN1) ITEM GROUP BEFORE UPDATION (COLUMN2)ITEM GROUP AFTER UPDATE (COLUMN 3)
    ITEM1 IG1 IG90
    ITEM2 IG2 IG10
    ITEM3 IG1 IG1
    ITEM4 IG9 IG2
    ITEM5 IG8 IG2
    ITEM6 IG1 IG3
    ITEM7 IG2 IG1
    ITEM8 IG3 IG9
    ITEM9 IG1 IG3
    ITEM10 IG9 IG1
    ITEM11 IG3 IG2
    ITEM12 IG90 IG1
    ITEM13 IG10 IG9
    ITEM14 IG1 IG8
    ITEM15 IG2 IG1

    I WANT TO UPDATE ITEM GROUP IN 1 SHORT.
    IF POSSIBLE PLEASE SHARE YOUR EMAIL ID SO THAT I CAN GIVE YOU SOME SAMPLE DATA.

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    So to clarify, you have a table with 3 columns: items (item_code, item_group_before, item_group_after)

    Correct?
    George
    Home | Blog

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    update mytable set column2 = column3
    as we don't know the name of your table, replace mytable in the above with the name of your table
    as we don't know the name of your columns, replace columnx in the above with the name of your columns
    I'd rather be riding on the Tiger 800 or the Norton

  6. #6
    Join Date
    Sep 2014
    Posts
    7

    Item group

    Hi,

    In my table (Table name is Item Master Table) two fields are there

    t_item = Item Code

    t_grop= Item Group

    ATTACHED IS EXAMPLE

    PLEASE PROVIDE YOUR EMAIL ID

    I AM NOT ABLE TO ATTACH THE SAMPLE DATA

  7. #7
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    We only need a sample, maybe 20 rows. Put the data in a post here, no need to email.
    George
    Home | Blog

  8. #8
    Join Date
    Sep 2014
    Posts
    7

    Item group

    Hi,

    Please see the attachment.
    Attached Files Attached Files

  9. #9
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Taking just one of your example rows:
    Code:
    ITEM CODE  |  ITEM GROUP BEFORE UPDATION  |  ITEM GROUP AFTER UPDATEION
    ITEM1      |  IG1                         |  IG90
    Why is the value afterwards IG90?
    George
    Home | Blog

  10. #10
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    eek
    looking in detail at your data it just doesn't make sense.....
    what was IG2 can become IG1 or IG10
    what was IG1 can become IG3, IG8, or IG90, or remain as IG1!

    unless you can define some business rules about how the new t_Grop is assigned then you will not be able to do this as an update query. you will have to edit things individually
    Last edited by healdem; 09-01-14 at 11:27.
    I'd rather be riding on the Tiger 800 or the Norton

Tags for this Thread

Posting Permissions

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