如何将这两个SQL合并为一个SQL?

时间:2018-06-28 08:08:14

标签: mysql sql database

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 个答案:

答案 0 :(得分:2)

使用 var xline = d3.scaleLinear().domain(45.103300, 40.1053737).range([0, 450.57913]); var yline = d3.scaleLinear().domain(12.186311, 12.605783).range([0, 350]); var svgViewport = d3.select("#mappa-italia").append("g").attr("id", "locations"); var circleElements = svgViewport.selectAll("circle").data(myData).enter().append("circle").attr("cx", function(d) { return xline(d.x); }).attr("cy", function(d) { return yline(d.y); }).attr("r", "5"); 表达式进行条件聚合:

case