Sybase SQL CASE statement problem

Hello Experts, I am creating a SQL query in Crystal Reports to run against a Sybase db. My select statement is
SELECT
ad.line1
  case
    when en.firm is not NULL then en.firm
     else en.first_name || ' ' || en.last_name AS Name
 end
  case
    when en.taxid is not NULL then en.taxid
     else en.ssno
 end
 FROM  
The CASE statements are not working. What am I doing wrong? Should I use COALESCE instead? If so, how would I write that?
JohnPellAsked:
Who is Participating?
 
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
My select statement is
SELECT
ad.line1
  case
    when en.firm is not NULL then en.firm
     else en.first_name || ' ' || en.last_name
 end AS Name
  case
    when en.taxid is not NULL then en.taxid
     else en.ssno
 end as tax_ssno
 FROM

you had the " as name " on the wrong place
0
 
JohnPellAuthor Commented:
Thanks! I did have to had a comma between the case statements, but it works fine.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.