## Feat - Top 30 (直推人数/直推金额) - 排除死点
This commit is contained in:
		
							parent
							
								
									71c74fecca
								
							
						
					
					
						commit
						0b540c6002
					
				| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue