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;
Bookmarks