Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select base.subscribed,count(base.id_for_vendor) ,AVG(base.AVGSession)
- from
- (select IdSub.id_for_vendor, IdSub.subscribed,AVG(UAB.usage_duration) as AVGSession
- from
- (select Dlog.id_for_vendor, case when Usub.id_for_vendor is null then 0 else 1 end as subscribed
- From
- (select distinct dil.id_for_vendor
- FROM public.facetune2_device_info_log as dil
- where dil.Original_purchase_timestamp is not null
- order by dil.id_for_vendor) as Dlog left join public.Facetune2_usage_store_user_subscribed as Usub
- on (Dlog.id_for_vendor=Usub.id_for_vendor)) as IdSub inner join public.Facetune2_usage_app_background UAB
- on (IdSub.id_for_vendor=UAB.id_for_vendor)
- group by IdSub.id_for_vendor, IdSub.subscribed
- ) as base
- group by base.subscribed;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement