Tonu Samuel wrote:
>
> On Tue, 5 Jun 2001, Mark Stosberg wrote:
>
> > > > second_to_last_visit from users where last_visit = NULL;
> > >
> > > What if you use "last_visit IS NULL"?
> >
> > Thanks, this works. I still think MySQL behaved poorly by not either:
> > a), accepting my syntax, or B.) throwing an error that the syntax was
> > incorrect. The result it returned appeared incorrect.
>
> It is not syntax error. MySQL always converts all types of variables into
> right ones. In your case last_visit is integer or datetime and right
> operand of equation was converted to it i.e. 0 not NULL. In most cases
> this is very good feature, not bug.
Tonu, thanks for the explanation. I still prefer the way Postgres
handles it:
mark=> create table t (c1 int, c2 date);
CREATE
mark=> insert into t (c1) values (1);
INSERT 2419818 1
mark=> select * from t where c2 = null;
c1 | c2
----+----
1 |
(1 row)
##########
-mark
http://mark.stosberg.com/
---------------------------------------------------------------------
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 <mysql-unsubscribe-##L=##[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php