1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Urgent: need help with very easy phpmyadmin SQL Update

Discussion in 'Other Languages' started by monchichi, Mar 19, 2015.

  1. monchichi

    monchichi Power Member

    Joined:
    Jun 3, 2011
    Messages:
    592
    Likes Received:
    250
    Occupation:
    BOSS.
    Location:
    173.194.35.147
    hi all,

    need some urgent help. I am no phpmyadmin guru so I guess it may be very easy for you.

    On a magento database I need to update sales_flat_order volumn customer_group_id

    where the customer_group_id = 0

    and I want it to update the value from another table:

    take it from table customer_entity and column name is group_id


    so in short:


    i want to do this:

    UPDATE sales_flat_order column "customer_group_id" where "customer_group_id" = 0

    and the new value of "customer_group_id" should be from "customer_entity" field "group_id"


    What to enter in phpmyadmin SQL ?



    thanks a lot for any help
     
  2. monchichi

    monchichi Power Member

    Joined:
    Jun 3, 2011
    Messages:
    592
    Likes Received:
    250
    Occupation:
    BOSS.
    Location:
    173.194.35.147
    this code did the job

    Code:
    update sales_flat_order sfo 
    join customer_entity ce on ce.entity_id = sfo.customer_id
    set sfo.customer_group_id = ce.group_id
    where sfo.customer_group_id=0
    
     
    • Thanks Thanks x 1