给每个订单加一列 month_end:下单时间 order_ts 所在月份的最后一天,类型为日期。
- 要正确处理大小月和闰年 2 月,例如
2024-02-10→2024-02-29,2025-02-10→2025-02-28。 - 订单本身就在月末那天时,结果就是当天,例如
2026-03-31 23:59:59→2026-03-31(不是下个月月末)。 order_ts为 null 时month_end为 null。
输入
orders(order_id, customer_id, order_ts, status, channel),order_ts不带时区。
输出
列为 order_id, month_end,每个订单一行,行顺序不限。