|  | @@ -31,11 +31,6 @@ from
 | 
	
		
			
				|  |  |          require_roi,require_mult from dw_daily_channel_cost) a
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -left outer join
 | 
	
		
			
				|  |  | -     (select date as dt3,channel as channel3,count(1) as first_order_count,          ---新用户首日充值
 | 
	
		
			
				|  |  | -     count(distinct user_id) as first_order_user,sum(amount) as first_order_amount
 | 
	
		
			
				|  |  | -    from order where status=2 and toDate(reg_time)=date  group by date,channel) c
 | 
	
		
			
				|  |  | -    on dt=dt3 and channel=channel3
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  left outer join
 | 
	
		
			
				|  |  |          (select date as dt4,channel as channel4,count(1) as order_count,   ---账面充值
 | 
	
	
		
			
				|  | @@ -62,6 +57,12 @@ left outer join
 | 
	
		
			
				|  |  |     count(1) as reg_order_count
 | 
	
		
			
				|  |  |     from order where status=2 and reg_time>'2019-03-18 00:00:00' group by toDate(formatDateTime(reg_time,'%Y-%m-%d')),channel) b
 | 
	
		
			
				|  |  |      on dt=dt2 and channel=channel2
 | 
	
		
			
				|  |  | +    left outer join
 | 
	
		
			
				|  |  | +     (select date as dt3,channel as channel3,count(1) as first_order_count,          ---新用户首日充值
 | 
	
		
			
				|  |  | +     count(distinct user_id) as first_order_user,sum(amount) as first_order_amount
 | 
	
		
			
				|  |  | +    from order where status=2 and toDate(reg_time)=date  group by date,channel) c
 | 
	
		
			
				|  |  | +    on dt=dt3 and channel=channel3    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      having order_amount+cost+reg_order_amount>0"""
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      data=ck.execute(sql)
 | 
	
	
		
			
				|  | @@ -229,4 +230,5 @@ if __name__ == '__main__':
 | 
	
		
			
				|  |  |      # dw_channel_amount_daily()
 | 
	
		
			
				|  |  |      # dw_channel_user_daily()
 | 
	
		
			
				|  |  |      # dw_channel_amount_daily_reverse()
 | 
	
		
			
				|  |  | -    del_channel()
 | 
	
		
			
				|  |  | +    dw_channel()
 | 
	
		
			
				|  |  | +    # del_channel()
 |