select uid, cast(sum(cnt) as signed) as cntfrom(select uid, product_id, count(*) as cntfrom(select trace_id, uid, logtime, step, product_id, if(step='select' and pay_method is not null, pay_method, 'error') as pay_methodfrom user_client_log) awhere step='order'group by uid, product_id) bgroup by uid...