# CASE / WHEN in T-SQL

CASE / WHEN in T-SQL: CASE / WHEN in T-SQL.

Updated: November 3, 2026

1. [CASE / WHEN in T-SQL](https://www.ask-codey.com/lessons/case-when-in-t-sql) (Journeyman): CASE picks a value by conditions, like if and else if. Use it to label rows, to count only the rows that match with SUM(CASE ...), and to sort in a custom order.

Source: https://www.ask-codey.com/courses/csharp-full-stack-bootcamp/topics/case-when-in-t-sql
