Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- WITH
- a AS (SELECT company_id,
- raised_amount
- FROM funding_round
- WHERE EXTRACT(YEAR FROM CAST(funded_at AS date)) BETWEEN '2012' AND '2013'),
- b AS(SELECT company_id,
- fund_id
- FROM investment),
- c AS (SELECT id,
- name
- FROM fund),
- d AS (SELECT id AS company_id,
- name As name_of_company
- FROM company
- WHERE milestones>6)
- SELECT c.name name_of_found,
- d.name_of_company,
- SUM(a.raised_amount) AS amount
- FROM a INNER JOIN b ON (a.company_id = b.company_id)
- INNER JOIN c ON (b.fund_id = c.id)
- INNER JOIN d ON(a.company_id = d.company_id)
- GROUP BY name_of_found,d.name_of_company
Add Comment
Please, Sign In to add comment