Untitled
unknown
plain_text
2 years ago
1.2 kB
7
Indexable
select
hotel,
arrival_date_year || '-' || mm as yyyy_mm,
season,
distribution_channel,
revenue
from(
select
hotel,
arrival_date_year,
case arrival_date_month
when 'Январь' then '01'
when 'Февраль' then '02'
when 'Март' then '03'
when 'Апрель' then '04'
when 'Май' then '05'
when 'Июнь' then '06'
when 'Июль' then '07'
when 'Август' then '08'
when 'Сентябрь' then '09'
when 'Октябрь' then '10'
when 'Ноябрь' then '11'
when 'Декабрь' then '12'
end as mm,
case
when arrival_date_month in ('Декабрь', 'Январь', 'Февраль') then 'Зима'
when arrival_date_month in ('Март', 'Апрель', 'Май') then 'Весна'
when arrival_date_month in ('Июнь', 'Июль', 'Август') then 'Лето'
when arrival_date_month in ('Сентябрь', 'Октябрь', 'Ноябрь') then 'Осень'
end as season,
distribution_channel,
(stays_in_week_nights + stays_in_week_nights) * cast(adr as integer) as revenue
from public.hotels_df hd
where is_canceled = 0
) as date_info
Editor is loading...