合并
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# 2025年10-12月 助教附加课(超休)时长排行榜
|
||||
## 思考过程
|
||||
按月汇总助教附加课时长,并用 dense_rank 做排名。
|
||||
|
||||
## 查询说明
|
||||
口径:order_assistant_type=2;时长=income_seconds/3600(小时)。
|
||||
|
||||
## SQL
|
||||
|
||||
### 附加课时长(助教+月份汇总)
|
||||
```sql
|
||||
with raw as (
|
||||
select
|
||||
asl.nickname as assistant,
|
||||
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
|
||||
asl.income_seconds
|
||||
from billiards_dwd.dwd_assistant_service_log asl
|
||||
where asl.site_id = %(site_id)s
|
||||
and coalesce(asl.is_delete,0)=0
|
||||
and asl.order_assistant_type=2
|
||||
and asl.start_use_time >= %(window_start)s::timestamptz
|
||||
and asl.start_use_time < %(window_end)s::timestamptz
|
||||
)
|
||||
select
|
||||
assistant,
|
||||
month_key,
|
||||
sum(income_seconds)/3600.0 as hours
|
||||
from raw
|
||||
where month_key is not null
|
||||
group by assistant, month_key;
|
||||
```
|
||||
Reference in New Issue
Block a user