When Simple Becomes Tricky: SQL CASE Statement - Issue 132
How to apply CASE conditional expressions to specify a result when there are multiple conditions.
It’s Wednesday, and I am back with another SQL how-to for your enjoyment.
Today’s topic is not new to anyone who works with SQL - it’s the famous CASE statement! This is SQL 101, and I expect that you have mastered it since back in the early days of my newsletter. For this publication, I have 2 main objectives: brush up and re-introduce the concept of CASE statements (neither you nor I can afford becoming rusty with a foundation), as well as remind all of us how easily mistakes can slip in and become overlooked.
It may or may not be inspired by me messing up with a CASE issue the other day.
Keep reading with a 7-day free trial
Subscribe to Data Analysis Journal to keep reading this post and get 7 days of free access to the full post archives.