Quote Originally Posted by philip_clarke View Post
I think carlvt88 is certainly along the correct lines, although I am not sure why the sort order is 999, but looking through some test data it does appear correct. I'd say that as a minimum the code should be
Code:
insert into so_payments (orders_id, payment_amount) 
select orders_id, value from zen_orders_total zot where zot.sort_order=999;
sort order = 999 is the default assigned to the ot_total class in the orders_total table. You can change the sort_order via admin in the menu under modules, but if you do, the above query will behave differently