Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7651983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:38:55+00:00 2026-05-31T11:38:55+00:00

What will be the SQL statement for this scenario ? tbl_user_account id INT(11) name

  • 0

What will be the SQL statement for this scenario ?

tbl_user_account

id INT(11)
name varchar(100)
username varchar(25)
password varchar(25)
active int(1)


_____________________________________
|id|name | username|password  |active|
_____________________________________
|1 |John | jhon123 | p@ssw0rd | 1  | 
|2 |Maria| maria321| p@ss     | 0  |

I wanted to fetch all the record but the active field must output
“YES” if it’s 1 or “No” if it’s 0

I wanted this OUTPUT :


|id|name | username|password  |active|
_____________________________________
|1 |John | jhon123 | p@ssw0rd | Yes  | 
|2 |Maria| maria321| p@ss     | No  |

do I need to create a function or just simply an if statement?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T11:38:56+00:00Added an answer on May 31, 2026 at 11:38 am

    Try this:

    select id, name, username, password, if (active >0, "YES", "NO") from table_name
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a sql statement like this: DECLARE @MyVariable as varchar(50) SET @MyVariable =
Im building a dynamic sql update statement. This statement will update an unknown number
From the mysql certification guide's example questions ... question Will the following SQL statement
What's the simplest SQL statement that will return the duplicate values for a given
Is there a SQL statement that will list the names of all the tables,
I'm looking for a dummy SQL statement that will work from a C# SQL
Is it possible to create a parameterized SQL statement that will taken an arbitrary
My understanding of Linq to Sql is it will take my Linq statement and
as i learner, i would like to learn how will be a sql statement
If i have a parameterized SQL statement like this: SELECT * FROM table WHERE

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.