Jim R Posted September 6, 2021 Share Posted September 6, 2021 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. Quote Link to comment https://forums.phpfreaks.com/topic/313675-update-query-not-working/ Share on other sites More sharing options...
Barand Posted September 6, 2021 Share Posted September 6, 2021 (edited) 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 September 6, 2021 by Barand Quote Link to comment https://forums.phpfreaks.com/topic/313675-update-query-not-working/#findComment-1589695 Share on other sites More sharing options...
Solution Barand Posted September 6, 2021 Solution Share Posted September 6, 2021 Alternatively ... WHERE server NOT IN ('gmail.com', 'yahoo.com') Quote Link to comment https://forums.phpfreaks.com/topic/313675-update-query-not-working/#findComment-1589697 Share on other sites More sharing options...
Jim R Posted September 6, 2021 Author Share Posted September 6, 2021 Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/313675-update-query-not-working/#findComment-1589698 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.