| Line 41... |
Line 41... |
| 41 |
end
|
41 |
end
|
| 42 |
usersegment, final.*
|
42 |
usersegment, final.*
|
| 43 |
from (select u.id, u.username, u.first_name, u.mobile_number, u.mobile_verified,
|
43 |
from (select u.id, u.username, u.first_name, u.mobile_number, u.mobile_verified,
|
| 44 |
if(bp.user_id is null, 'FALSE', 'TRUE') as bpref,
|
44 |
if(bp.user_id is null, 'FALSE', 'TRUE') as bpref,
|
| 45 |
if(pp.user_id is null, 'FALSE', 'TRUE') as ppref, u.created ucreated, ua.last_active, ow.created, if(ow.total is null, 0, ow.total) as total,
|
45 |
if(pp.user_id is null, 'FALSE', 'TRUE') as ppref, u.created ucreated, ua.last_active, ow.created, if(ow.total is null, 0, ow.total) as total,
|
| 46 |
u.referrer,u.utm_campaign, u.utm_content, u.utm_term, u.utm_medium, u.utm_source
|
46 |
u.referrer,u.utm_campaign, u.utm_content, u.utm_term, u.utm_medium, u.utm_source, u.
|
| 47 |
from users u left join useractive ua on ua.user_id=u.id
|
47 |
from users u left join useractive ua on ua.user_id=u.id
|
| 48 |
left join (select distinct user_id from price_preferences) pp on pp.user_id=u.id
|
48 |
left join (select distinct user_id from price_preferences) pp on pp.user_id=u.id
|
| 49 |
left join (select distinct user_id from brand_preferences) bp on bp.user_id=u.id
|
49 |
left join (select distinct user_id from brand_preferences) bp on bp.user_id=u.id
|
| 50 |
left join (select *, count(*) as total from (select user_id, created from order_view where status = 'ORDER_CREATED' order by id desc) as a1 group by user_id) as ow on ow.user_id = u.id
|
50 |
left join (select *, count(*) as total from (select user_id, created from order_view where status = 'ORDER_CREATED' order by id desc) as a1 group by user_id) as ow on ow.user_id = u.id
|
| 51 |
where lower(u.referrer) not like 'emp%' or u.referrer is null) final;
|
51 |
where lower(u.referrer) not like 'emp%' or u.referrer is null) final;
|
| Line 100... |
Line 100... |
| 100 |
worksheet.write(row, 13, 'Campaign', boldStyle)
|
100 |
worksheet.write(row, 13, 'Campaign', boldStyle)
|
| 101 |
worksheet.write(row, 14, 'Content', boldStyle)
|
101 |
worksheet.write(row, 14, 'Content', boldStyle)
|
| 102 |
worksheet.write(row, 15, 'Term', boldStyle)
|
102 |
worksheet.write(row, 15, 'Term', boldStyle)
|
| 103 |
worksheet.write(row, 16, 'Medium', boldStyle)
|
103 |
worksheet.write(row, 16, 'Medium', boldStyle)
|
| 104 |
worksheet.write(row, 17, 'Utm Source', boldStyle)
|
104 |
worksheet.write(row, 17, 'Utm Source', boldStyle)
|
| - |
|
105 |
worksheet.write(row, 18, 'Activation Flag', boldStyle)
|
| 105 |
|
106 |
|
| 106 |
for r in result:
|
107 |
for r in result:
|
| 107 |
row += 1
|
108 |
row += 1
|
| 108 |
column = 0
|
109 |
column = 0
|
| 109 |
for data in r :
|
110 |
for data in r :
|