Write a query to return every row in orders with last_amount, the amount of that customer’s final order, and pct_of_last, the current amount divided by that final amount and multiplied by 100, rounded to one decimal place.
Determine the final order by ascending order_ts, then order_id, within each customer. Include all statuses. The final order has a percentage of 100.0 when its reference amount is recorded and non-zero.
Ordering: Sort by customer_id, then order_ts, then order_id, all ascending.