Lalit
Lalit

Reputation: 13

add one column to table with value against the Other Columns Specific Values

I am Having Below Mention Table Where I want to Add column by query which will add one column to table with value against the Other Columns Specific Values Consider Following Table

Name     Toggle Value
 John           1
 Nyasa          0
 Albert         1
 Micheal        0
 Laura          1
 Leah           0

In this Table in Front Of 1 want Text As ACTIVE and In front of Zero(0) I want it As INACTIVE with Column Name Status.

Upvotes: 0

Views: 87

Answers (1)

Unnikrishnan R
Unnikrishnan R

Reputation: 5031

Use the CASE statement in your query .

SELECT Name ,Togglevalue, Case WHEN Togglevalue=1 THEN 'ACTIVE' ELSE 'INACTIVE' END as Status
FROM YourTable

Upvotes: 1

Related Questions