| Line 163... |
Line 163... |
| 163 |
l.transfer_price, p.gatewayId,
|
163 |
l.transfer_price, p.gatewayId,
|
| 164 |
case when pa.value is null then case when p.gatewayId = 1 then 2099 when p.gatewayId = 2 then 1099 else null end else pa.value end 'payment_method',
|
164 |
case when pa.value is null then case when p.gatewayId = 1 then 2099 when p.gatewayId = 2 then 1099 else null end else pa.value end 'payment_method',
|
| 165 |
t.coupon_code,
|
165 |
t.coupon_code,
|
| 166 |
case when t.session_source is null then 'Unknown' when t.session_source like 'DIRECT%' then 'Direct' when t.session_source like 'ORGANIC%' then 'Organic' when t.session_source like 'PAID%' then 'Paid' else 'Referer' end as session_source_type,
|
166 |
case when t.session_source is null then 'Unknown' when t.session_source like 'DIRECT%' then 'Direct' when t.session_source like 'ORGANIC%' then 'Organic' when t.session_source like 'PAID%' then 'Paid' else 'Referer' end as session_source_type,
|
| 167 |
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(t.session_source,'://',-1),'/',1),'www.',-1) as session_source_url,
|
167 |
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(t.session_source,'://',-1),'/',1),'www.',-1) as session_source_url,
|
| - |
|
168 |
case when datediff(t.session_start_time, u.source_start_time) > 30 then 0 when datediff(t.session_start_time, u.source_start_time) > 15 then 1
|
| - |
|
169 |
when datediff(t.session_start_time, u.source_start_time) > 7 then 2 when datediff(t.session_start_time, u.source_start_time) > 2 then 3
|
| 168 |
datediff(t.session_start_time, u.source_start_time) as days_to_purchase,
|
170 |
when datediff(t.session_start_time, u.source_start_time) > 1 then 4 else 5 as days_to_purchase,
|
| 169 |
aff.name aff_name
|
171 |
aff.name aff_name
|
| 170 |
FROM `order` o
|
172 |
FROM `order` o
|
| 171 |
left join lineitem l on(o.id = l.order_id )
|
173 |
left join lineitem l on(o.id = l.order_id )
|
| 172 |
left join (select * from payment.payment order by id desc) p on (o.transaction_id = p.merchantTxnId)
|
174 |
left join (select * from payment.payment order by id desc) p on (o.transaction_id = p.merchantTxnId)
|
| 173 |
left join payment.paymentattribute pa on (p.id = pa.payment_id and pa.name = 'payMethod')
|
175 |
left join payment.paymentattribute pa on (p.id = pa.payment_id and pa.name = 'payMethod')
|