Untitled
unknown
plain_text
2 years ago
1.1 kB
9
Indexable
select case when CREATED_ON >=date_sub(current_timestamp(),interval 4 hour) then '1-4 Hours'
when CREATED_ON <=date_sub(current_timestamp(),interval 10 hour) and CREATED_ON >= date_sub(current_timestamp(),interval 4 hour) then '4-10 Hours'
when CREATED_ON <=date_sub(current_timestamp(),interval 24 hour) and CREATED_ON >= date_sub(current_timestamp(),interval 10 hour) then '>10-24 Hours' end as 'Date Range',
order_line_action,
CREATED_ON as Date,
count(*) as 'Total',
sum(case when ORDER_LINE_STATUS in ('NEW') then 1 else 0 end) as 'NEW',
sum(case when ORDER_LINE_STATUS in ('SUBMITTED') then 1 else 0 end) as 'SUBMITTED',
sum(case when ORDER_LINE_STATUS in ('IN_PROGRESS') then 1 else 0 end) as 'IN_PROGRESS',
sum(case when ORDER_LINE_STATUS in ('COMPLETED') then 1 else 0 end) as 'COMPLETED',
sum(case when ORDER_LINE_STATUS in ('CANCELLED') then 1 else 0 end) as 'CANCELLED',
sum(case when ORDER_LINE_STATUS in ('SUSPENDED') then 1 else 0 end) as 'SUSPENDED',
sum(case when ORDER_LINE_STATUS in ('DISCARDED') then 1 else 0 end) as 'DISCARDED'
from tibom.tom_order_lines
group by 1,2Editor is loading...