Help with CASE statement

  • Hi. I have the following CASE statement:

    CASE

    WHEN LT.SourceType = 'M' THEN MO.SystemType

    ELSE 'N/A'

    END AS 'MOStatus'

    This works OK and returns MO.SystemType values (I, C).

    I would like it to return (Issued, Completed). Maybe a CASE within a CASE?

    Hope that makes sense!

    Kinds Regards,

    Phil.

    -------------------------------------------------------------------------------------
    A neutron walks into a bar. "I'd like a beer" he says. The bartender promptly serves up a beer. "How much will that be?" asks the neutron. "For you?" replies the bartender, "no charge."

    Two hydrogen atoms walk into a bar. One says, 'I think I've lost an electron.' The other says 'Are you sure?' The first says, 'Yes, I'm positive... '

    Tommy Cooper

  • CASE

    WHEN LT.SourceType = 'M' AND MO.SystemType = 'I' THEN 'Issued'

    WHEN LT.SourceType = 'M' AND MO.SystemType = 'C' THEN 'Completed'

    ELSE 'N/A'

    END AS 'MOStatus'

  • Thanks, works a treat.

    Kind Regards,

    Phil.

    -------------------------------------------------------------------------------------
    A neutron walks into a bar. "I'd like a beer" he says. The bartender promptly serves up a beer. "How much will that be?" asks the neutron. "For you?" replies the bartender, "no charge."

    Two hydrogen atoms walk into a bar. One says, 'I think I've lost an electron.' The other says 'Are you sure?' The first says, 'Yes, I'm positive... '

    Tommy Cooper

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply