Need Alias Select Query? | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Need Alias Select Query?

In my sqlserver databse i have one of tables which is having numeric values as 1 or 0 which indicates 1 for Active and 0 for Inactive. I want to select that as Active and Inactive by using select query.
I know littel bit about this means i know to select one type like
actually, in my database stored values 1 or 0 as i mentioned above, so i use "select ‘Active’ as active from postjob", this works fine. Now what i want is in single query i want to select 1 as Active and 0 as Inactive. Hope you understand, Is there any way to select like this.
Plz help me out. Thanking You, Lalitha.C
Use a case statement:
SELECT CASE <fieldName> WHEN 1 THEN ‘Active’ WHEN 0 THEN ‘Inactive’ END AS Active
FROM postjob Ben ‘I reject your reality and substitute my own’ – Adam Savage
Hi benwilson,
Thank you so much, my probelm was solved with your solution. Thank you, Lalitha.C