RE: Query problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



you can't use COL_NAME = NULL or COL_NAME = 'NULL' and get the desired
results , you have to check for IS NULL/ IS NOT NULL....So, change the
query to

SELECT * FROM TABLE WHERE MY_FIELD IS NULL  or,
SELECT * FROM TABLE WHERE MY_FIELD IS NOT NULL

>From my understanding when you check for  COL_NAME = 'Null' you're actually
checking to see if your field contains a _string_  'Null'

hth
jeff




                                                                                                                                        
                      "Boaz Yahav"                                                                                                      
                      <berber@netvision        To:       "Ron Allen" <Ronald.Allen@bondsteel2.areur.army.mil>, <php-db@lists.php.net>   
                      .net.il>                 cc:                                                                                      
                                               Subject:  RE:  Query problem                                                     
                      07/22/2003 03:16                                                                                                  
                      PM                                                                                                                
                                                                                                                                        
                                                                                                                                        




Assuming you run MySQL, why don't you just remove the " ' "?

SELECT * FROM MyTable WHERE MyField=NULL

Sincerely

berber

Visit http://www.weberdev.com/ Today!!!
To see where PHP might take you tomorrow.
Share your code : http://addexample.weberdev.com


-----Original Message-----
From: Ron Allen [mailto:Ronald.Allen@bondsteel2.areur.army.mil]
Sent: Tuesday, July 22, 2003 11:29 AM
To: php-db@lists.php.net
Subject:  Query problem


I have done this in the past, but for some reason it isn't working now
(maybe a moron).  I am trying to select all of the empty or NULL fields
in a column.

This is what I have
select * from ticket where Type = 'Line' and Closeddate = ' empty space'
and have tried the following select * from ticket where Type = 'Line'
and Closeddate = 'Null' select * from ticket where Type = 'Line' and
Closeddate = 'NULL'

any clues ????



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux