Skip to content
Advertisement

Multiple conditions in CASE WHEN statement

I’m working in SQL (Amazon Redshift) with Recruitment data where each applicant has multiple sources, which I’ve split into different columns called source_1, source_2, and source_3, along with a number_of_sources column to record how many sources that applicant has. We want each applicant to only have one source, and have certain rules to follow in how to select which source, and I’m trying to write a CASE WHEN statement to achieve this. I’m currently getting an error but I can’t see why.

My code is:

Hope that makes sense, any advice would be appreciated! Thanks so much

Advertisement

Answer

remove all else except the last one

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement