[Solved] Select criteria using a case expression in where clause based on other columns [closed]


SELECT ID,SUM(CASE WHEN Level=1 AND Grade IN ('A','B','C','D') THEN 1 
            WHEN Level=2 AND Grade IN ('A','B','C') THEN 1
            ELSE 0
       END AS GradeCount
FROM YourTable
GROUP BY ID;

0

solved Select criteria using a case expression in where clause based on other columns [closed]