Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Временная таблица с минимальними значениями
- WITH i_min AS (SELECT funded_at,
- MIN(raised_amount)
- FROM funding_round
- WHERE raised_amount!=0
- GROUP BY funded_at
- ),
- -- Временная таблица с МАКСИмальними значениями
- i_max AS
- (SELECT funded_at,
- MAX(raised_amount)
- FROM funding_round
- WHERE raised_amount!= -- в подзапросе МАКСимальное значение инвестиций
- (SELECT MAX(raised_amount)
- FROM funding_round)
- GROUP BY funded_at)
- --основной запрос
- SELECT i_min.funded_at,
- i_min.min,
- i_max.max
- FROM i_min
- LEFT JOIN i_max ON i_min.funded_at = i_max.funded_at
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement