03-Feb-2022
.
Admin
Hello Friends,
This article will give you example of MySQL case statement multiple conditions. I explained simply about how to use case statement in MySQL. This tutorial will give you simple case with multiple conditions SQL query.
In this post, You'll learn use case when in MySQL with multiple conditions. i will show you use of MySQL case when multiple conditions.
Here i will give you many example for MySQL case statement with multiple conditions.
So let's see bellow solution:
Table: user_payments
So, let's see bellow solution:
Solution SQL Query:
SELECT
id,
user_id,
charge,
CASE WHEN status = 1 THEN 'PAID'
WHEN status = 2 THEN 'FAIL'
WHEN status = 3 THEN 'WAIT'
ELSE 'PENDING'
END as status
FROM `user_payments`
Output:
I hope it will help you...
#MySQL