Jurijus Zaksas
Искусственный Интеллект
(445806)
3 года назад
SELECT F.FILIAL_NAME, S.SEGMENT, SUM(B.REVENUE)
FROM FILIAL F
INNER JOIN SUBSCRIBERS S
ON F.FILIAL_ID=S.FILIAL_ID
INNER JOIN BILLS B
ON S.SUBS_ID=B.SUBS_ID
WHERE EXTRACT YEAR FROM B.MONTH_START_DATE = 2017
AND EXTRACT MONTH FROM B.MONTH_START_DATE = 1
GROUP BY F.FILIAL_NAME, S.SEGMENT
ORDER BY 1, 2