Link to home
Start Free TrialLog in
Avatar of dbrennecke
dbrennecke

asked on

Nested SQL Case help, please

What am I doing wrong here?  Many thanks to whomever sets me straight... I am getting a syntax error. (id and step are defined and are not the prob here...). Single case works fine. Nesting does not.
'Phase'=CASE
    WHEN id = 12
          CASE
      when step < 5 THEN 'Stage 1'
      <more whens...>
                     ELSE 'Final Stage'
          END
  WHEN id = 18
        CASE
      when step < 3 THEN 'Phase 1'
                      <more whens...>
      ELSE 'Final Phase'
        END
    ELSE 'Dunno'
END
ASKER CERTIFIED SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dbrennecke
dbrennecke

ASKER

that does not seem to be the problem...
Upon further review, you were correct. I noticed that you slipped in 2 missing THENs.  Thanks!
dbrennecke said:
>>that does not seem to be the problem...

No, the problem was that you were missing some THENs :)