Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with funds as (
- select
- extract(month from fr.funded_at) mon,
- count(distinct i.fund_id) fund_count
- from funding_round fr
- left join investment i on i.funding_round_id = fr.id
- left join fund f on f.id = i.fund_id
- where
- extract(year from fr.funded_at) between 2010 and 2013 and
- f.country_code = 'USA'
- group by extract(month from fr.funded_at)
- ),
- sells as (
- select
- extract(month from acquired_at) mon,
- count(distinct acquired_company_id) company_count,
- sum(price_amount) sum_price_amount
- from acquisition a
- group by extract(month from a.acquired_at)
- )
- select
- f.mon,
- f.fund_count,
- sells.company_count,
- sells.sum_price_amount
- from funds f
- join sells on sells.mon = f.mon
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement