Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 where mydate=NULL MYSQL

Author  Topic 

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2006-12-14 : 08:58:08
I have teh following query:

select * from tableb where dateclosed=null order by id desc

even when in the tableb there is a record with dateclosed=null -- this is still returning 0 records. why?

table data is as follows:


id dateclosed
1 NULL
2 NULL

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-12-14 : 08:59:26
make use of IS NULL:

select * from tableb where dateclosed is null order by id desc


Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-12-14 : 09:10:41

Still didnt you know that you cant compare NULL using =?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-12-14 : 10:14:56
This is SQL Server Forum.

You should post at www.DBForums.com or www.MYSQL.com





CODO ERGO SUM
Go to Top of Page
   

- Advertisement -