変態SQLの例 with login_count_partner as ( select partner_id , count(distinct created_time) as count_total_login , count(distinct case when created_time >= current_date - interval'7 days' then created_time end) as count_login_in_7 from partner_login group by partner_id ), partner_movie_attach as ( select mh.partner_id , max(case when mmh.movie_id is not null then 1 else 0 end) as movie_attach_flg from
