Jump to content

UPDATE query not working...


Jim R
Go to solution Solved by Barand,

Recommended Posts

I'm trying to change all school served email addresses to NULL because they are mostly static and in the schools data table.  Some coaches list their non-school email address, so I keep that with them as they change jobs.  I'm mostly just trying to clean up the coach data table to make sure I don't have conflicting information.  However, the below query is changing all the rows to NULL, including the ones with gmail and yahoo.  

update a_coach set server = NULL
where server != "gmail.com" or server != "yahoo.com"

I've also tried it with <> instead of !=.  Same result. This seems like it should've been pretty straight forward.  

image.thumb.png.12e9ed0b7cb9adaffe46b453550518a5.png

Link to comment
Share on other sites

Simple boolean algebra

NOT (A OR B) = NOT A AND NOT B

As you have it,

  • if the server=yahoo then it is not equal to gmail - so that condition is satisfied and therefore set to NULL
  • if the server=gmail then it is not equal to yahoo- so that condition is satisfied and therefore set to NULL
Edited by Barand
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.