Urgent: need help with very easy phpmyadmin SQL Update

monchichi

Power Member
Joined
Jun 3, 2011
Messages
626
Reaction score
265
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
 
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
 
Back
Top