- WITH sold_company AS (SELECT id,
- name as sold_company_name,
- funding_total AS invested_on_sold_company
- FROM company
- WHERE status = 'acquired'
- )
- SELECT name,
- price_amount,
- sold_company_name,
- invested_on_sold_company,
- AVG(price_amount/invested_on_sold_company)
- FROM acquisition AS a
- JOIN company AS cb ON a.acquiring_company_id=cb.id
- JOIN sold_company AS cs ON a.acquired_company_id=cs.id
- WHERE price_amount !=0
- GROUP BY cb.name, a.price_amount, cs.sold_company_name, cs.invested_on_sold_company
Untitled
From Alex, 4 Months ago, written in Plain Text, viewed 67 times.
This paste will hop the perch in 1 Second.
URL http://codebin.org/view/17c53c6c
Embed
Download Paste or View Raw
— Expand Paste to full width of browser