Change return value of selected SELECT statement

You can change the value of a selected column with the help of conditions. In select statement, case-when-statement takes  if-statement’s place.

CASE WHEN
condition_statement
THEN if_value ELSE else_value END AS column_name

Sample of a case when statement:

CASE WHEN A.containsParameter=1 THEN 'Yes' ELSE 'No' END as containsParameter

WhatILearnTodaySeries #1

PS: If you find this article useful please use like button 🙂 and if you have a question or a comment, don’t hesitate to share it!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s