INSERT ALL
when sum_orders < 1000 then
into small_order
when sum_orders >= 1000 and sum_orders < 10000 then
into medium_order
else
into lager_order
select custom_id, sum(order_total) sum_orders from orders group by custom_id ;
注:all 多表插入標誌。