阅读背景:

sql的执行顺序,外连接注意点

来源:互联网 
select
  date(oi.pay_time)            as event_date,
  count(distinct oi.device_id) as uv,
  count(*)                     as order_total,
  (select platform
   from app_event_log_start_up as su
   where su.uid = oi.user_id
         and date(su.event_time) = '$day'
   limit 1)                    as os,
  pol.user_id
from order_info oi
  left join points_ops_log pol on pol.user_id = oi.user_id
                                  and date(pol.create_time) = '$day'
                                  and pol.ops = 'obtain'
                                  and pol.worker in ('xx', 'xx', 'xx')
where date(oi.pay_time) = '$day'
      and pol.user_id is null
group by os
having os is not null;
select
  date(oi.pay_time)            as eve



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: