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

  • SEARCH
  • Home
  • 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 4335766
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:42:54+00:00 2026-05-21T10:42:54+00:00

I have a enum(‘Y’,’N’) field in db table with many records hold the status

  • 0

I have a enum('Y','N') field in db table with many records hold the status of record active(Y) or inactive(N) .

Only one record can be active at a time. An interface is given to show all the records with their status if it is active then it is showing word Active if it is inactive a submit button provided to make it active with each record.

Right now I am doing with two update commands

update table_name set active="Y" where id=$id
update table_name set active="N" where id != $id

My question is:-

Really Do I needs two update command to execute or Is their any update command to update them in once?

  • 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-21T10:42:55+00:00Added an answer on May 21, 2026 at 10:42 am

    You could do

     UPDATE table_name
        SET active = 
            CASE WHEN id = $id THEN "Y"
                 ELSE "N"
            END
    

    Confirm the syntax though – I didn’t actually try the code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an enum that maps to possible field values in a char(1) field
So I thought that an enum would help me with States. Basically, I have
I have a base class that has an enum value that I am using
I have a class with a enum DoStuff with values before , after ,
I have a method which takes an Enum. Say method is methodName(MyTypes) where MyTypes
I have read somewhere that the C++ standard does not allow something like enum
i have a list of custom object and i want to group the object
I have a comboBox that has a datatrigger that set its SelectedIndex based on
I think this question needs some code: private TypeValues GetEnumValues(Type enumType, string description) {
I'm pondering on exception handling and unit tests best practices because we're trying to

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.