Select the largest number from MYSQL Table with added Prefix -


i have table unfortunately, can't alter in way , have work have.

the mysql table has field labeled, "customer_id". has 2 prefixed letters 4-value numerical number.

ex: bi8392

he8492

wo1293

how can select largest numerical value prefix? example, assume wanted select largest number prefix of he. how can select value?

any absolutely appreciated. i've been stuck while now.

since values left padded can do

select right(max(customer_id), 4) max_val   table1  customer_id 'he%' 

make sure have index on customer_id based on name of column. like use it.

here sqlfiddle demo


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -