Ollie Ollie 3 3 silver badges 12 12 bronze badges. Consider this before adding function on a search predicate tech-recipes. Valid point, without seeing the rest of the query or how the output is used or the expected result set to work with, its hard to say if its entirely appropriate or not.
I would usually handle nulls in a CTE and filter on that instead — Ollie. The Overflow Blog. Podcast Making Agile work for data science. Stack Gives Back Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Related 2. DForck42 DForck42 Sorry, here is the little more simplify upbuilded sql query.
Andrew Andrew 1. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Making Agile work for data science. Many thanks. Ed Cunningham Ed Cunningham 1 1 gold badge 3 3 silver badges 14 14 bronze badges.
Can you show us some sample data as well? The first answer provided seems likely. Add a comment. Active Oldest Votes. SqlZim SqlZim MikeS MikeS 1, 1 1 gold badge 8 8 silver badges 12 12 bronze badges.
Here is another way to tackle this. Sean Lange Sean Lange Kirk Woll Marcelo Cantos Marcelo Cantos k 37 37 gold badges silver badges bronze badges. It's marginally less efficient, but much more elegant. In the end, you have the same result. If you need to optimize, check the execution plans but I have not noticed much of a difference. Nordic Mainframe Nordic Mainframe I didn't know that. Haven't thought that there are so much possibilities to do that. There are plenty of solutions but none covers why the original statement doesn't work.
NeatNit 1 1 gold badge 2 2 silver badges 12 12 bronze badges. Ian Jacobs Ian Jacobs 5, 1 1 gold badge 22 22 silver badges 37 37 bronze badges. Yeah realized it after I posted. Figured I'd leave it since it solved the part he was having trouble with.
The problem is that null is not considered equal to itself, hence the clause never matches. Something unknown, is most likely not the same as something else that is unkown. Found a solution to this.
0コメント