- WITH
- tab1 AS (SELECT EXTRACT(MONTH FROM CAST(funded_at AS timestamp)) AS month1,
- COUNT (DISTINCT fund.name) AS funds
- FROM funding_round AS fr
- LEFT OUTER JOIN investment AS i ON fr.id = i.funding_round_id
- LEFT OUTER JOIN fund ON i.company_id = fund.id
- WHERE EXTRACT(YEAR FROM CAST(funded_at AS timestamp)) BETWEEN 2010 AND 2013
- AND fund.country_code='USA'
- GROUP BY month1),
- tab2 AS (SELECT EXTRACT(MONTH FROM CAST(acquired_at AS timestamp)) AS month2,
- COUNT(acquired_company_id) AS acquired,
- SUM(price_amount) AS summ
- FROM acquisition
- WHERE EXTRACT(YEAR FROM CAST(acquired_at AS date)) BETWEEN 2010 AND 2013
- GROUP BY month2)
- SELECT month1,
- funds,
- acquired,
- summ
- FROM tab1 JOIN tab2 ON tab1.month1 = tab2.month2
- ORDER BY month1;
#22/23
From Sweltering Matamata, 10 Months ago, written in Plain Text, viewed 233 times.
This paste is a reply to Re: Re: Untitled from Social Curlew
- view diff
URL http://codebin.org/view/692e88d0
Embed
Download Paste or View Raw
— Expand Paste to full width of browser