-
Feb 15th, 2018, 11:41 AM
#1
Thread Starter
Don't Panic!
[RESOLVED] MS SQL - Where IN using a coalesce
Hi
Nice and simple question:
Why won't it work ?
Code:
...
WHERE table.pkid = 1
AND COALESCE(table.field, '') IN ( '','D' )
I have data, this particular field is null. Without this coalesce line it brings back the rows. With it it brings back nothing.
Is the IN clause filtering the data before the COALESCE is applied?
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Feb 15th, 2018, 12:32 PM
#2
Re: MS SQL - Where IN using a coalesce
I don't know but try isNull(table.field,'').
Please remember next time...elections matter!
-
Feb 15th, 2018, 02:01 PM
#3
Thread Starter
Don't Panic!
Re: MS SQL - Where IN using a coalesce
Nah I got it - I was being silly and added a NOT to the line. Something from the previous statement I was changing. It negated everything, so all ok. Sorry to have bothered you with this
Thanks for the suggestion
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|