Subversion Repositories SmartDukaan

Rev

Rev 5857 | Rev 7203 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5857 Rev 6474
Line 178... Line 178...
178
         <partitioning>
178
         <partitioning>
179
           <method>none</method>
179
           <method>none</method>
180
           <schema_name/>
180
           <schema_name/>
181
           </partitioning>
181
           </partitioning>
182
    <connection>transactionDC_Prod</connection>
182
    <connection>transactionDC_Prod</connection>
183
    <sql>SELECT SQL_NO_CACHE o.id &apos;order_id&apos;, o.customer_id, o.customer_pincode, 
183
    <sql>SELECT SQL_NO_CACHE o.id &apos;order_id&apos;, o.customer_id, o.customer_pincode,  o.status &apos;order_status&apos;, o.total_amount, ps.hotspotId as pickupStoreId,  
184
o.status &apos;order_status&apos;, o.total_amount, ps.hotspotId as pickupStoreId, 
-
 
185
datediff(o.created_timestamp, &apos;20101231&apos;) as date_id, hour(o.created_timestamp) as order_hour,
184
		datediff(o.created_timestamp, &apos;20101231&apos;) as date_id, hour(o.created_timestamp) as order_hour, o.transaction_id, l.item_id, l.quantity, 
186
o.transaction_id, l.item_id, l.quantity,
185
		case when unit_price&lt;250 then 0 when unit_price&lt;500 then 1 when unit_price&lt;1000 then 2 
187
case when unit_price&lt;250 then 0 when unit_price&lt;500 then 1 when unit_price&lt;1000 then 2 when unit_price&lt;2000 then 3 when unit_price &lt; 5000 then 4 when unit_price &lt; 10000 then 5 when unit_price &lt; 15000 then 6 when unit_price &lt;20000 then 7 when unit_price &lt; 50000 then 8 else 9 end as price_range,
186
			 when unit_price&lt;2000 then 3 when unit_price &lt; 5000 then 4 when unit_price &lt; 10000 then 5 when unit_price &lt; 15000 then 6 
188
l.transfer_price, p.gatewayId, 
187
			 when unit_price &lt;20000 then 7 when unit_price &lt; 50000 then 8 else 9 end as price_range, l.transfer_price, p.gatewayId,  
189
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 &apos;payment_method&apos;,
188
		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 &apos;payment_method&apos;, 
190
upper(trim(t.coupon_code)) as coupon_code, 
189
		upper(trim(t.coupon_code)) as coupon_code,  
191
case when t.session_source is null then &apos;Unknown&apos; when t.session_source like &apos;DIRECT%&apos; then &apos;Direct&apos; when t.session_source like &apos;ORGANIC%&apos; then &apos;Organic&apos; when t.session_source like &apos;PAID%&apos; then &apos;Paid&apos; else &apos;Referer&apos; end as session_source_type,
190
		case when t.session_source is null then &apos;Unknown&apos; when t.session_source like &apos;DIRECT%&apos; then &apos;Direct&apos; when t.session_source like &apos;ORGANIC%&apos; then &apos;Organic&apos; 
-
 
191
			 when t.session_source like &apos;PAID%&apos; then &apos;Paid&apos; else &apos;Referer&apos; end as session_source_type, 
192
SUBSTRING_INDEX(REPLACE(REPLACE(SUBSTR(session_source, LOCATE(&apos;http:&#47;&#47;&apos;, LCASE(session_source)), LENGTH(session_source)), &apos;http:&#47;&#47;&apos;, &apos;&apos;), &apos;www.&apos;, &apos;&apos;), &apos;&#47;&apos;, 1) as session_source_url,
192
		SUBSTRING_INDEX(REPLACE(REPLACE(SUBSTR(session_source, LOCATE(&apos;http:&#47;&#47;&apos;, LCASE(session_source)), LENGTH(session_source)), &apos;http:&#47;&#47;&apos;, &apos;&apos;), &apos;www.&apos;, &apos;&apos;), &apos;&#47;&apos;, 1) as session_source_url, 
193
case when datediff(t.session_start_time, u.source_start_time) &gt; 30 then 0 when datediff(t.session_start_time, u.source_start_time) &gt; 15 then 1
193
		case when datediff(t.session_start_time, u.source_start_time) &gt; 30 then 0 when datediff(t.session_start_time, u.source_start_time) &gt; 15 then 1
194
when datediff(t.session_start_time, u.source_start_time) &gt; 7 then 2 when datediff(t.session_start_time, u.source_start_time) &gt; 2 then 3
194
			 when datediff(t.session_start_time, u.source_start_time) &gt; 7 then 2 when datediff(t.session_start_time, u.source_start_time) &gt; 2 then 3
195
when datediff(t.session_start_time, u.source_start_time) &gt; 1 then 4 else 5 end as days_to_purchase,
195
			 when datediff(t.session_start_time, u.source_start_time) &gt; 1 then 4 else 5 end as days_to_purchase, aff.name aff_name, 
196
aff.name aff_name,
196
		case when o.originalOrderId is null then datediff(o.created_timestamp, &apos;20101231&apos;)
197
case when o.originalOrderId is null then datediff(o.created_timestamp, &apos;20101231&apos;) else datediff((select created_timestamp from `order` where id = o.originalOrderId), &apos;20101231&apos;) end as booking_date_id
197
			 else datediff((select created_timestamp from `order` where id = o.originalOrderId), &apos;20101231&apos;) end as booking_date_id 
198
FROM `order` o 
198
FROM `order` o  
199
left join lineitem l on(o.id = l.order_id ) 
199
left join lineitem l on(o.id = l.order_id )  
200
left join (select * from payment.payment order by id desc) p on (o.transaction_id = p.merchantTxnId) 
200
left join payment.payment p on (o.transaction_id = p.merchantTxnId and p.id=(select max(id) from payment.payment where merchantTxnId = o.transaction_id))  
201
left join payment.paymentattribute pa on (p.id = pa.payment_id and pa.name = &apos;payMethod&apos;)
201
left join payment.paymentattribute pa on (p.id = pa.payment_id and pa.name = &apos;payMethod&apos;) 
202
left join transaction t on (o.transaction_id = t.id)
202
left join transaction t on (o.transaction_id = t.id) 
203
left join user.tracklog tl on (tl.data like concat(convert(p.id, char), &apos;%&apos;)) 
203
left join user.tracklog tl on (tl.user_id = o.customer_id and tl.data like concat(convert(p.id, char), &apos;%&apos;))  
204
left join user.user u on (u.id = o.customer_id) 
-
 
205
left join user.affiliate aff on (tl.affiliate_id = aff.id)
204
left join user.user u on (u.id = o.customer_id)  left join user.affiliate aff on (tl.affiliate_id = aff.id) 
206
left join logistics.pickupstore ps on (o.pickupStoreId = ps.id)
205
left join logistics.pickupstore ps on (o.pickupStoreId = ps.id) group by order_id</sql>
207
group by order_id</sql>
-
 
208
    <limit>0</limit>
206
    <limit>0</limit>
209
    <lookup/>
207
    <lookup/>
210
    <execute_each_row>N</execute_each_row>
208
    <execute_each_row>N</execute_each_row>
211
    <variables_active>N</variables_active>
209
    <variables_active>N</variables_active>
212
    <lazy_conversion_active>N</lazy_conversion_active>
210
    <lazy_conversion_active>N</lazy_conversion_active>