RedShift <= целочисленный неверный оператор в регистре - PullRequest
0 голосов
/ 26 апреля 2019

У меня есть:

select
       month,
       year,
       -- package 5 counts by sliding screening price
       case
           when total_count_package_5 <= 75 then SUM(total_count_package_5) end         as total_count_package_5_15,
       case
           when total_count_package_5 >= 76 and <= 150 then SUM(total_count_package_5) end  as total_count_package_5_13,
       case
           when total_count_package_5 >= 151 and <= 600 then SUM(total_count_package_5) end as total_count_package_5_12,
       case
           when total_count_package_5 >= 601 and <= 800 then SUM(total_count_package_5) end as total_count_package_5_10,
       case
           when total_count_package_5 >= 801 then SUM(total_count_package_5) end        as total_count_package_5_8,

from screening_packages_5_6_count_2018

group by year, month, total_count_package_5, total_count_package_6

order by month, year desc;

Но я получаю сообщение об ошибке <= целое число не существует.Я вижу это как доступный оператор в руководстве по красному смещению, но получаю ошибку.Что еще я могу использовать здесь?</p>

Спасибо,

1 Ответ

0 голосов
/ 26 апреля 2019

Исправлено:

select
       month,
       year,
       -- package 5 counts by sliding screening price
       case
           when (total_count_package_5 <= 75) then SUM(total_count_package_5) end         as total_count_package_5_15,
       case
           when (total_count_package_5 >= 76 and total_count_package_5<= 150) then SUM(total_count_package_5) end  as total_count_package_5_13,
       case
           when (total_count_package_5 >= 151 and total_count_package_5<= 600) then SUM(total_count_package_5) end as total_count_package_5_12,
       case
           when (total_count_package_5 >= 601 and total_count_package_5<= 800) then SUM(total_count_package_5) end as total_count_package_5_10,
       case
           when (total_count_package_5 >= 801) then SUM(total_count_package_5) end        as total_count_package_5_8,

       -- package 6 counts by sliding screening price
       case
           when (total_count_package_6 <= 75) then sum(total_count_package_6) end         as total_count_package_6_20,
       case
           when (total_count_package_6 >= 76 and total_count_package_5<= 150) then sum(total_count_package_6) end  as total_count_package_6_18,
       case
           when (total_count_package_6 >= 151 and total_count_package_5<= 600) then sum(total_count_package_6) end as total_count_package_6_17,
       case
           when (total_count_package_6 >= 601 and total_count_package_5<= 800) then sum(total_count_package_6) end as total_count_package_6_15,
       case
           when (total_count_package_6 >= 801) then sum(total_count_package_6) end        as total_count_package_6_13


from screening_packages_5_6_count_2018

group by year,month
       , total_count_package_5, total_count_package_6

order by month desc;
...