Advertisement
Guest User

Untitled

a guest
Nov 13th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. select base.subscribed,count(base.id_for_vendor) ,AVG(base.AVGSession)
  2. from
  3. (select IdSub.id_for_vendor, IdSub.subscribed,AVG(UAB.usage_duration) as AVGSession
  4. from
  5. (select Dlog.id_for_vendor, case when Usub.id_for_vendor is null then 0 else 1 end as subscribed
  6. From
  7. (select distinct dil.id_for_vendor
  8. FROM public.facetune2_device_info_log as dil
  9. where dil.Original_purchase_timestamp is not null
  10. order by dil.id_for_vendor) as Dlog left join public.Facetune2_usage_store_user_subscribed as Usub
  11. on (Dlog.id_for_vendor=Usub.id_for_vendor)) as IdSub inner join public.Facetune2_usage_app_background UAB
  12. on (IdSub.id_for_vendor=UAB.id_for_vendor)
  13. group by IdSub.id_for_vendor, IdSub.subscribed
  14. ) as base
  15. group by base.subscribed;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement