4

I am trying to concat an individual's first and last name together but coalesce a team name when there is a null value. Unfortunately my syntax is returning a SPACE, so coalesce does not recognize it as a null value.. What can I do to correct this?

Syntax I am currently using:

coalesce((Concat(first_name,' ',last_name)),team_name)
1
  • So you want to get team_name even if only one of the other names is null? Commented Jan 20, 2017 at 18:28

1 Answer 1

6

Just use the concatenation operator, ||:

coalesce(first_name || ' ' || last_name, team_name)

The concat() function ignores NULL values. The operator returns NULL.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.