记得上下班打卡 | git大法好,push需谨慎

Commit 97db5662 authored by anjiabin's avatar anjiabin

提交演出数据统计

parent 6bbc6f66
...@@ -394,7 +394,7 @@ ...@@ -394,7 +394,7 @@
kt.use_start, kt.use_start,
IFNULL(kts.total_general , 0) AS 'total_general' , IFNULL(kts.total_general , 0) AS 'total_general' ,
IFNULL(ot.total_sale_general , 0) AS 'sale_general' , IFNULL(ot.total_sale_general , 0) AS 'sale_general' ,
IFNULL((kts.total_general - ot.total_sale_general),0) AS 'surplus_general', IFNULL((kts.total_general - IFNULL(ot.total_sale_general,0)),0) AS 'surplus_general',
IFNULL(ot.total_sale_price , 0) AS 'total_sale_price' , IFNULL(ot.total_sale_price , 0) AS 'total_sale_price' ,
IFNULL(kts.total_exchange , 0) AS 'total_exchange', IFNULL(kts.total_exchange , 0) AS 'total_exchange',
IFNULL(ot.total_refund_general , 0) AS 'total_refund_general', IFNULL(ot.total_refund_general , 0) AS 'total_refund_general',
...@@ -403,8 +403,11 @@ ...@@ -403,8 +403,11 @@
IFNULL(otp.total_paying_number , 1) AS 'total_paying_number', IFNULL(otp.total_paying_number , 1) AS 'total_paying_number',
IFNULL(ut.total_buy_users , 0) AS 'total_buy_users' IFNULL(ut.total_buy_users , 0) AS 'total_buy_users'
FROM FROM
(select t.performances_id from kylin_performances t where t.performances_id = ${performancesId}) AS kp (select t.performances_id,ktr.ticket_id from kylin_performances t inner join kylin_ticket_time_relation kttr
inner JOIN( on t.performances_id = kttr.performance_id
inner join kylin_ticket_relations ktr on kttr.times_id = ktr.times_id
where t.performances_id = ${performancesId}) AS kp
left JOIN(
SELECT SELECT
kotr.performance_id AS 'performance_id', kotr.performance_id AS 'performance_id',
kotr.ticket_id, kotr.ticket_id,
...@@ -420,7 +423,7 @@ ...@@ -420,7 +423,7 @@
WHERE 1>0 and kotr.performance_id = ${performancesId} WHERE 1>0 and kotr.performance_id = ${performancesId}
and kots.`status` in(1,3,4) and kot.coupon_type ='no' and kots.`status` in(1,3,4) and kot.coupon_type ='no'
group by kotr.performance_id,kotr.ticket_id group by kotr.performance_id,kotr.ticket_id
) AS ot ON ot.performance_id = kp.performances_id ) AS ot ON (ot.performance_id = kp.performances_id and ot.ticket_id = kp.ticket_id)
left JOIN( left JOIN(
SELECT SELECT
kotr.performance_id,kotr.ticket_id, kotr.performance_id,kotr.ticket_id,
...@@ -432,9 +435,9 @@ ...@@ -432,9 +435,9 @@
WHERE 1>0 and kotr.performance_id = ${performancesId} WHERE 1>0 and kotr.performance_id = ${performancesId}
and kots.`status` = 0 and kot.coupon_type ='no' and kots.`status` = 0 and kot.coupon_type ='no'
group by kotr.performance_id,kotr.ticket_id group by kotr.performance_id,kotr.ticket_id
) AS otp ON otp.performance_id = kp.performances_id ) AS otp ON (otp.performance_id = kp.performances_id and otp.ticket_id = kp.ticket_id)
inner join kylin_tickets kt on kt.tickets_id = ot.ticket_id left join kylin_tickets kt on kt.tickets_id = kp.ticket_id
inner join kylin_ticket_status kts on kts.ticket_id = kt.tickets_id left join kylin_ticket_status kts on kts.ticket_id = kp.ticket_id
inner JOIN( inner JOIN(
select t.performance_id,count(t.user_id) as 'total_buy_users' from( select t.performance_id,count(t.user_id) as 'total_buy_users' from(
SELECT SELECT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment