sql - Retrieve maximum number from alphanumeric column -
please can me sql query how maximum number alphanumeric field. below code field. can see want retrieve highest number oss 120. in advance.
asg1 asg10 asg14 asg2 asg21 asg4 lts1 lts10 lts14 lts2 lts21 lts4 oss1 oss10 oss100 oss11 oss114 oss120 oss2 oss21 oss3 oss4 oss5 oss6 oss7
you can use regular expression this. work every length of string , number.
select column_name table_name regexp_replace(column_name,'[a-za-z]','')= (select max(to_number(regexp_replace(column_name,'[a_za-z]',''))) table_name)
Comments
Post a Comment