List:General Discussion« Previous MessageNext Message »
From:Gerald Clark Date:June 5 2001 8:53pm
Subject:Re: Nulls appear not be respected
View as plain text  
You need to read up on what NULL means.
There is nothing that = NULL.

try:
WHERE last_visit IS NULL

Mark Stosberg wrote:

> I'm using MySQL 3.23.32 and having trouble selecting values where a
> column is null. Any help is appreciated. An example is below: 
> 
> I need to get the rows where the last_visit column in the users table is
> NULL. 
> I can see that there are some with this select statement: 
> (last_visit is a date field) 
> 
> mysql> select user_id,screen_name,last_visit, second_to_last_visit from
> users;
> +---------+-----------------+------------+----------------------+
> | user_id | screen_name     | last_visit | second_to_last_visit |
> +---------+-----------------+------------+----------------------+
> |       1 | xxxxxx-fake     | NULL       | NULL                 |
> |       2 | xxxxxxxxxx-fake | NULL       | NULL                 |
> |       3 | xxxxx-admin     | 2001-05-24 | 2001-05-07           |
> |       4 | xxxx-admin      | 2001-05-08 | 2001-05-07           |
> |       5 | xxxxx-admin     | 2001-03-23 | 2001-03-21           |
> 
> 
> However, if I ask for the rows where last_visit = NULL, it says there are
> not any! :
> mysql> select user_id,screen_name,password,last_visit,
> second_to_last_visit from users where  last_visit = NULL;
> Empty set (0.00 sec)
> 
> Ideas?
> 
> Below is some more information about my environment. 
> 
> Thanks!
> 
>   -mark 
> 
> 
>> Release:       mysql-3.22.32 (TCX binary)
> 
> 
>> Environment:
> 
>         <machine, os, target, libraries (multiple lines)>
> System: SunOS sun01101.dn.net 5.6 Generic_105181-19 sun4u sparc
> SUNW,UltraSPARC-IIi-Engine
> Architecture: sun4
> 
> Some paths:  /bin/perl /usr/ccs/bin/make /usr/local/bin/gmake
> /usr/local/bin/gcc /usr/ucb/cc
> GCC: Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/specs
> gcc version 2.95.2 19991024 (release)
> Compilation info: CC='gcc'  CFLAGS='-O3 -fomit-frame-pointer'  CXX='gcc'
>  CXXFLAGS='-O3 -fomit-
> frame-pointer -felide-constructors -fno-exceptions -fno-rtti'  LDFLAGS=''
> Configure command: ./configure  --prefix=/usr/local/mysql
> '--with-comment=TCX binary' --with-low-memory --disable-shared
> Perl: This is perl, version 5.005_03 built for sun4-solaris
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <mysql-thread75568@stripped>
> To unsubscribe, e-mail
> <mysql-unsubscribe-gerald_clark=suppliersystems.com@stripped>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-- 
Gerald L. Clark
gerald_clark@stripped

Thread
Nulls appear not be respectedMark Stosberg5 Jun
  • Re: Nulls appear not be respectedVan5 Jun
  • Re: Nulls appear not be respectedJeremy Zawodny5 Jun
  • Re: Nulls appear not be respectedMark Stosberg5 Jun
    • Re: Nulls appear not be respectedTonu Samuel6 Jun
      • Re: Nulls appear not be respectedMark Stosberg6 Jun
    • Re: Nulls appear not be respectedPaul DuBois6 Jun
  • Re: Nulls appear not be respectedGerald Clark5 Jun
  • Re: Nulls appear not be respectedMark Stosberg5 Jun
    • Re: Nulls appear not be respectedBob Hall7 Jun
  • RE: Nulls appear not be respectedMichael Eklund5 Jun