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 <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
><[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
--
Gerald L. Clark
[EMAIL PROTECTED]
---------------------------------------------------------------------
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 <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php