活跃农民
- 积分
- 322
- 大米
- 颗
- 鳄梨
- 个
- 水井
- 尺
- 蓝莓
- 颗
- 萝卜
- 根
- 小米
- 粒
- 学分
- 个
- 注册时间
- 2012-7-16
- 最后登录
- 1970-1-1
|
之前的有bug这个通过测试了
- .google и
- select COALESCE(s.transation_month,m.transation_month) as transaction_month
- , COALESCE(s.country, m.country) as country,
- COALESCE(s.approve_count,0)AS approved_count,
- COALESCE(s.approve_amount,0)AS approved_amount,
- COALESCE(m.chargeback_count,0) AS chargeback_count,.--
- COALESCE(m.chargeback_amount,0)AS chargeback_amount
-
- from. 1point3acres.com
- (select DATE_FORMAT(t.transaction_date, '%Y-%m') as transation_month,
- t.country,
- COALESCE(sum(case when t.state= 'approved' then 1 else 0 end),0) as approve_count,
- COALESCE(sum(case when t.state= 'approved' then t.amount else 0 end),0) as approve_amount
-
- from Transactions t.google и
-
- group by DATE_FORMAT(t.transaction_date, '%Y-%m'), t.country) s
-
- left join
-
- (select DATE_FORMAT(c.chargeback_date, '%Y-%m') as transation_month,
- t.country,
- COALESCE(sum(case when t.state= 'approved' then 1 else 0 end),0) as chargeback_count,
- COALESCE(sum(t.amount),0) as chargeback_amount
-
- from Transactions t
- join Chargebacks c on t.transaction_id = c.transaction_id
-baidu 1point3acres - group by DATE_FORMAT(c.chargeback_date,'%Y-%m'),t.country) m
-
- on s.transation_month= m.transation_month and s.country = m.country
- union
- select COALESCE(s.transation_month,m.transation_month) as transaction_month.1point3acres
- , COALESCE(s.country, m.country) as country,
- COALESCE(s.approve_count,0)AS approved_count,
- COALESCE(s.approve_amount,0)AS approved_amount,
- COALESCE(m.chargeback_count,0) AS chargeback_count,
- COALESCE(m.chargeback_amount,0)AS chargeback_amount
-
- from. 1point 3acres
- (select DATE_FORMAT(t.transaction_date, '%Y-%m') as transation_month,
- t.country,
- COALESCE(sum(case when t.state= 'approved' then 1 else 0 end),0) as approve_count,
- COALESCE(sum(case when t.state= 'approved' then t.amount else 0 end),0) as approve_amount. ----
-
- from Transactions t. 1point3acres.com
-
- group by DATE_FORMAT(t.transaction_date, '%Y-%m'), t.country) s
- . .и
- right join
-
- (select DATE_FORMAT(c.chargeback_date, '%Y-%m') as transation_month,
- t.country,
- COALESCE(sum(case when t.state= 'approved' then 1 else 0 end),0) as chargeback_count,
- COALESCE(sum(t.amount),0) as chargeback_amount.--
- . Waral dи,
- from Transactions t
- join Chargebacks c on t.transaction_id = c.transaction_id
- group by DATE_FORMAT(c.chargeback_date,'%Y-%m'),t.country) m
-
- on s.transation_month= m.transation_month and s.country = m.country
复制代码 |
|