Home Forums SQL Server 2008 T-SQL (SS2K8) Using the case statement to show a particular column code RE: Using the case statement to show a particular column code

  • Thank you that worked. But now I want to have the distinct values for the column which is satisfied in the case statement and also want to get the condition satisfied for the variable &divisionbox but oracle does not accept Boolean. So how can I put the Boolean condition?

    Select CASE WHEN '&REGIONDIVISION' is not null AND ('&DIVISIONID' NOT IN ( 'Non-Technical', 'Technical')) AND '&DIVISIONBOX' = FALSE THEN SEGMENTNAME

    ELSE REGIONNAME END as Segment,

    sUM(spreadamt) AS SPREAD, FROM table a

    GROUP BY CASE WHEN '&REGIONDIVISION' is not null AND('&DIVISIONID' NOT IN ( 'Non-Technical', 'Technical')) THEN SEGMENTNAME

    ELSE REGIONNAME END