## Feat - Top 30 (直推人数/直推金额) - 排除死点

This commit is contained in:
sangelxiu1 2025-09-24 15:03:58 +08:00
parent 517ed94bd9
commit 486340aedc
1 changed files with 12 additions and 11 deletions

View File

@ -12,15 +12,16 @@
numberOfAmount
from (
select
PK_REFERENCE,
count(PK_REFERENCE) numberOfPeople,
o.PK_REFERENCE,
count(DISTINCT o.PK_MEMBER) numberOfPeople,
sum(order_amount) numberOfAmount
from sa_order
from sa_order o
right join cu_member m on m.PK_ID = o.pk_member and m.DEL_FLAG = 0 and m.CATEGORY = 0
where
del_flag = 0
o.del_flag = 0
and order_status = 1
AND (order_type in (1,2) or (order_Type = 3 and ORDER_TYPE_EXTEND = 1))
and pay_time between #{param.startDate} and #{param.endDate}
and o.pay_time between #{param.startDate} and #{param.endDate}
group by PK_REFERENCE
) r
left join cu_member cm on r.PK_REFERENCE = cm.pk_id
@ -37,16 +38,16 @@
numberOfAmount
from (
select
PK_REFERENCE,
count(PK_REFERENCE) numberOfPeople,
o.PK_REFERENCE,
count(DISTINCT o.PK_MEMBER) numberOfPeople,
sum(order_amount) numberOfAmount
from sa_order
from sa_order o
right join cu_member m on m.PK_ID = o.pk_member and m.DEL_FLAG = 0 and m.CATEGORY = 0
where
del_flag = 0
o.del_flag = 0
and order_status = 1
AND (order_type in (1,2) or (order_Type = 3 and ORDER_TYPE_EXTEND = 1))
and pay_time between #{param.startDate} and #{param.endDate}
group by PK_REFERENCE
and o.pay_time between #{param.startDate} and #{param.endDate}
) r
left join cu_member cm on r.PK_REFERENCE = cm.pk_id
WHERE ROWNUM <![CDATA[ <=]]> 30