0

When executed the following query it is returning null.

Explanation: the longitude is a varchar column, many rows are there having longitude = null but this query did not return anything.

I thing I am missing a minute thing.

select * from fb_event where longitude =null
1
  • This is not a SQL Server issue - reading an indtroduction into SQL is needed, XXXcoder. Trinary logic is the same in all SQL implementations for a good reason. Commented Nov 2, 2011 at 6:29

1 Answer 1

4

Your where clause should read where longitude is null.

Null does not equal null, so you must use "is" instead of "=".

Sign up to request clarification or add additional context in comments.

2 Comments

+1 NULL really isn't a value - it's the absence of a value - therefore you cannot use the regular value comparison
More exact as NULL is unknown, comparing one unknown with another can not ever be true - NULL != NULL. NULL also destroys values. SUM with one item NULL is also NULL (unknown).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.