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

Поділитися
Вставка
  • Опубліковано 29 лис 2024

КОМЕНТАРІ • 1

  • @ishanshubham8355
    @ishanshubham8355 5 днів тому +1

    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