> sql,query
> Hi,
> 
> Joseph Bueno suggested the following syntax:
> 
> SELECT column_name,length(column_name) as len FROM table_name
> ORDER BY len DESC
> LIMIT 1
> 
> When I tried this on a column that contains NULL values I get:
>  +------+------+
>  | text | len  |
>  +------+------+
>  | NULL | NULL |
>  +------+------+
>  1 row in set (0.43 sec)
> 
> (Where text is the column_name)
> 
> On columns that don't contain NULL values it works fine, so I edited it
> to:
> SELECT column_name,length(column_name) as len FROM table_name
> WHERE column_name IS NOT NULL
> ORDER BY len DESC
> LIMIT 1
> 
> Which works even on the first column...
> 
> Is it normal behaviour that NULL values are considered to be "longer"
> strings than non-NULL values?
> 
> Regards
-- 
 #  Mertens Bram "M8ram" <[EMAIL PROTECTED]>   Linux User #249103  #
 #  Red Hat Linux 7.3  KDE 3.0.0-10  kernel 2.4.18-3  i686  128MB RAM  #


---------------------------------------------------------------------
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

Reply via email to