The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> NULL problem in SQL Server
DeaPeaJay
post Feb 14 2007, 12:20 PM
Post #1


Advanced Member
****

Group: Members
Posts: 103
Joined: 21-September 06
From: East Tennessee - USA
Member No.: 191



I've brainstormed and researched this problem but I just can't seem to figure it out.

This is my SQL

CODE

select name, title, department, about, notes from Providers
where name != ANY
    (select provider from needProviders
        where needID = 1)


pretty straightforward. the provider column is a foreign key to the name column. I'm trying to remove from the result set the names that are in the inner query. It works great! Just as I expect it would, unless the inner query returns an empty result set. Then, it doesn't return anything at all, when it *should* return everything, since name is not equal to an empty result set.

I'm just confused as to what SQL Server is doing, I suspect that I wouldn't have this problem with mySQL. Or am I missing something obvious? blink.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
DeaPeaJay
post Feb 14 2007, 12:55 PM
Post #2


Advanced Member
****

Group: Members
Posts: 103
Joined: 21-September 06
From: East Tennessee - USA
Member No.: 191



Ok, that's just weird. I used "not in" instead of "!= ANY" and now it works. Logically I don't see why that would make a difference but it did.

This post has been edited by DeaPeaJay: Feb 14 2007, 12:55 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 27th April 2024 - 12:12 PM