Many a times, in our SQL select statement we would need a “if then else” logic to be applied. one way is to select the data from the table into table variable ...
The CASE expression selects values if certain conditions are met. A CASE expression returns a single value that is conditionally evaluated for each row of a table (or view). Use the WHEN-THEN clauses ...