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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:28:14+00:00 2026-06-10T07:28:14+00:00

I’m trying to figure out why I’m not getting a result from a MySQL

  • 0

I’m trying to figure out why I’m not getting a result from a MySQL Query I’m running.

I’m trying to replace a NULL value with a number with in a query, but I can’t figure out what I’m doing wrong.

Here’s my query:

UPDATE Details
SET HowHear_ID = CASE HowHear_ID
  WHEN '' THEN 25   
  WHEN NULL THEN 25                         
  WHEN 7  THEN 25
  WHEN 8  THEN 5
  WHEN 16 THEN 25
  WHEN 17 THEN 16
END
WHERE HowHear_ID IN ('',NULL,7,8,16,17)

This Query will effect all but the NULL values.

What am I doing wrong??

  • 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-10T07:28:16+00:00Added an answer on June 10, 2026 at 7:28 am

    No value will ever equal (or “unequal”) NULL in SQL. Understand the following truth table:

    NULL = NULL yields NULL   -- not FALSE!
    NULL != NULL yields NULL  -- not TRUE!
    [ANY] = NULL yields NULL  -- not FALSE!
    [ANY] != NULL yields NULL -- not TRUE!
    

    Since the following are equivalent…

    [expression] IN (a, b, c)
    [expression] = ANY (a, b, c)
    [expression] = a OR [expression] = b OR [expression] = c
    

    … you cannot put NULL on the right hand side of an IN predicate. Interestingly, things get even worse when you put NULL on the right hand side of a NOT IN predicate:

    [expression] NOT IN (a, b, c)
    [expression] != ANY (a, b, c)
    [expression] != a AND [expression] != b AND [expression] != c
    

    If b were NULL, the whole expression will become NULL (or maybe FALSE), but never TRUE. This is also the case for NOT IN (subselect) predicates! So, never do this:

    [expression] NOT IN (NULL, 1, 2)
    

    The correct solution in your case uses a NULL predicate instead. Do this:

    UPDATE Details
    SET HowHear_ID = CASE 
      WHEN HowHear_ID = ''    THEN 25   
      WHEN HowHear_ID IS NULL THEN 25  -- Use a NULL predicate here
      WHEN HowHear_ID = 7     THEN 25
      WHEN HowHear_ID = 8     THEN 5
      WHEN HowHear_ID = 16    THEN 25
      WHEN HowHear_ID = 17    THEN 16
    END
    WHERE HowHear_ID IN ('',7,8,16,17)
       OR HowHear_ID IS NULL           -- Use a NULL predicate here
    

    Or this:

    WHERE COALESCE(HowHear_ID, '') IN ('',7,8,16,17)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Does anyone know how can I replace this 2 symbol below from the string
I am currently running into a problem where an element is coming back from
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text

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.