I get a dynamic string with values separated by comma. Need to extract max value using regexp_substr. e.g "55,222,3,4000,10" I need to extract 4000 in the above case using regex in MySQL.
I'd do this using an array. Something like: <?php $numbers = array(55,222,3,4000,10); foreach ($numbers as $i); echo max($numbers); ?> Code (markup): Example: https://onecompiler.com/php/3yrpmwhvp
So the numbers are stored in a single column in the database and you need to extract the greatest as part of your query? I'd create a stored procedure that will explode the string, sort in numerical order and return the max value. You then call the stored procedure from your query.