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 8334349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:19:08+00:00 2026-06-09T03:19:08+00:00

I am trying this update statement using a case in MySQL, but It does

  • 0

I am trying this update statement using a case in MySQL, but It does not change any values.

The query does not give any errors, but there are 0 affected rows.

UPDATE `tablename`
SET `type` = (
    CASE
        WHEN `type` = 1 THEN 1
        WHEN `type` = 2 THEN 2
        WHEN `type` = 3 THEN 19
        WHEN `type` = 4 THEN null
        WHEN `type` = 5 THEN null
        WHEN `type` = 6 THEN 81
        WHEN `type` = 7 THEN null
        WHEN `type` = 8 THEN 22
        WHEN `type` = 9 THEN 21
        WHEN `type` = 10 THEN 78
        WHEN `type` = 11 THEN 80
        WHEN `type` = 12 THEN 79
    END)
WHERE user_id IS NOT NULL;

Anyone know how I can fix this.

  • 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-06-09T03:19:11+00:00Added an answer on June 9, 2026 at 3:19 am

    Try moving type after the Case.

    UPDATE `tablename`
    SET `type` = 
        CASE `type`
            WHEN  1 THEN 1
            WHEN  2 THEN 2
            WHEN  3 THEN 19
            WHEN  4 THEN null
            WHEN  5 THEN null
            WHEN  6 THEN 81
            WHEN  7 THEN null
            WHEN  8 THEN 22
            WHEN  9 THEN 21
            WHEN  10 THEN 78
            WHEN  11 THEN 80
            WHEN  12 THEN 79
        END
    WHERE user_id IS NOT NULL;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to update/change contact ringtone using this code: ContentValues values = new ContentValues();
I have a problem when trying to execute this update statement (below) using C#
I am trying to use this MySQL query: SET @a:=0; UPDATE tbl SET sortId=@a:=@a+1
Recently, I was trying to optimise this query UPDATE Analytics SET UserID = x.UserID
I'm trying to update my text area via ActionScript code using this: scoreLabel.text =
I am trying to get Update queries from a list of files using this
I'm trying to request a single location update using the new LocationManager.requestSingleUpdate() method, but
I'm trying to update supplier table on both PostgreSQL and MySQL using the following
I am trying update text views while this loop is processing. Here is my
I am trying to update a table according to this trigger: CREATE TRIGGER alert

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.