> 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
On Wed, 2002-11-06 at 14:39, Brent Baisley wrote:
> SELECT MAX(LENGTH(column)) FROM db
Thx Brent! This works perfectly!
> That will give you the length of the longest string but won't tell you
> what the value is. To get the value also, you could do something like
> this, but I think there shou
Mertens Bram wrote:
> Hi,
>
> How can I find the longest string in a column?
>
> I can probably write a PHP-script that checks the str_length
> recursively, but I would like to be able to do this within MySQL...
>
> I would like to have the value and the length of the string if this is
> possibl