select partnerid, count(distinct processId) balance_count
from mipay.operation_log
where date = '20180501' and source = 'api' and operation = 'pay'
group by partnerid and info like "%BANLANCE%" group by partnerid;
结果:
partnerid balance_count
1 11
2 13
select partnerid, count(distinct processId) bankcard_count
from mipay.operation_log
where date = '20180501' and source = 'api' and operation = 'pay'
group by partnerid and info like "%BANKCARD%" group by partnerid;
结果:
partnerid bankcard_count
1 23
2 17
我希望通过一个sql得到以下结果
partnerid balance_count bankcard_count
1 11 23
2 17 17
1条答案
按热度按时间n1bvdmb61#
使用
case
条件聚合的表达式: