select o.performance_title as 'title',r.performance_id as 'performanceId' ,SUM(r.agent_distributions * (o.price-o.price_refund)) as 'commiss',kp.time_end as 'timeEnd'
select ss.*,kp.time_end as 'timeEnd' from (
from (select * from kylin_order_tickets where created_at>DATE_SUB(CURDATE(), INTERVAL 6 MONTH)) as o,
select o.performance_title as 'title',r.performance_id as 'performanceId' ,SUM(r.agent_distributions * (o.price-o.price_refund)) as 'commiss'
kylin_order_ticket_status as s,kylin_order_ticket_relations as r ,kylin_performances kp where o.order_tickets_id=s.order_id and o.order_tickets_id=r.order_id
from (select * from kylin_order_tickets where created_at>DATE_SUB(CURDATE(), INTERVAL 6 MONTH)) as o
and r.agent_id=#{agentId} and s.pay_status='1' GROUP BY r.performance_id
LEFT JOIN kylin_order_ticket_status as s on o.order_tickets_id=s.order_id
LEFT JOIN kylin_order_ticket_relations as r ON o.order_tickets_id=r.order_id
where r.agent_id=#{agentId} and s.pay_status='1' GROUP BY r.performance_id)
as ss ,kylin_performances kp where ss.performanceId=kp.performances_id