Deloitte SQL Interview Question 2024 | Cases that reached each stage of completion for each center

Поделиться
HTML-код
  • Опубликовано: 26 ноя 2024

Комментарии • 1

  • @ishanshubham8355
    @ishanshubham8355 День назад

    I tried solving it on MYSQL
    with cte as (
    Select *,
    concat_ws(",",stage1,stage2,stage3,stage4,stage5) as cnct1,
    concat_ws(",",stage2,stage3,stage4,stage5) as cnct2,
    concat_ws(",",stage3,stage4,stage5) as cnct3,
    concat_ws(",",stage4,stage5) as cnct4,
    concat_ws(",",stage5) as cnct5
    from CaseProgress)
    select center_id,
    sum(if(length(cnct1)0,1,0)) as stage1,
    sum(if(length(cnct2)0,1,0)) as stage2,
    sum(if(length(cnct3)0,1,0)) as stage3,
    sum(if(length(cnct4)0,1,0)) as stage4,
    sum(if(length(cnct5)0,1,0)) as stage5
    from cte
    group by 1