您好,我有一个可以包含字符串或数字的索引字符串字段。我想得到这个索引的最大值和最小值,但我希望一个只有数字的索引是整数,否则是字符串。例如我想要:
( "1", "5", "10" ) MIN=1 MAX=10 // mind MAX=10 not 5 as string order!
( "A", "D", "Z" ) MIN=A MAX=Z
我试过这个:
MAX(IF(CAST(idxfield as UNSIGNED)=0,CAST(idxfield as UNSIGNED),idxfield)) as maxField
但不起作用。