Home Forums SQL Server 2008 T-SQL (SS2K8) How to add a manual column based on GroupBy for title RE: How to add a manual column based on GroupBy for title

  • Something like

    select

    case

    when <logical expression1 depending only on High, Medium, Low columns> then 'High'

    when <logical expression2 depending only on High, Medium, Low columns> then 'Medium'

    else 'Low' end as [ColHML],

    sum(case .... ) then 1 else 0 end) as [Column1],

    sum(case .... ) then 1 else 0 end) as [Column2],

    sum(case .... ) then 1 else 0 end) as [Column3]

    from sometable

    Group by High, Medium, Low