max(length(field)) in mysql

前端 未结 9 573
南方客
南方客 2021-01-30 06:25

If I say:

select max(length(Name)) 
  from my_table

I get the result as 18, but I want the concerned data also. So if I say:

s         


        
9条回答
  •  清酒与你
    2021-01-30 06:47

    Edited, will work for unknown max() values:

    select name, length( name )
    from my_table
    where length( name ) = ( select max( length( name ) ) from my_table );
    

提交回复
热议问题