KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
So I have a simple query that returns a listing of products SELECT Model, CategoryID FROM Products WHERE (Model = '010-00749-01') This returns 010-00749-01 00000000-0000-0000-0000-000000000000 010-00749-01 NULL Which is correct, so I wanted only the products whose CategoryID is not '00000000-0000-0000-0000-000000000000' so I have SELECT Model, CategoryID FROM Products WHERE (Model = '010-00749-01') AND (CategoryID <> '00000000-0000-0000-0000-000000000000') But this returns no result. So I changed the query to SELECT Model, CategoryID FROM Products WHERE (Model = '010-00749-01') AND ((CategoryID <> '00000000-0000-0000-0000-000000000000') OR (CategoryID IS NULL)) Which returns expected result 010-00749-01 NULL Can someone explain this behavior to me? MS SQL Server 2008
Tags (comma-separated)
Save Edits
Cancel