Untitled

 avatar
unknown
plain_text
2 years ago
695 B
6
Indexable
select
	hotel, yyyy_mm, reservation_status, count(*) as number_of_bookings
from(
	select
		hotel,
		arrival_date_year::text || '-' ||
		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 yyyy_mm,
		distribution_channel,
		reservation_status
	from public.hotels_df hd
) as date_info
group by hotel, yyyy_mm, reservation_status
Editor is loading...