Q:

MySQL: return max of the last 5 digits from column

just need help with regular expression in mysql query please:
column ISRC
GBCQV0700378
GBCQV0700382
GBCQV0700387

i need 00387 returned to me (the biggest number)
i'm using:
SELECT max(ISRC) REGEXP "/(\d{5})$/" FROM digital_info; // returns 0

SELECT max(ISRC) FROM digital_info as m where (ISRC REGEXP "/(\d{5})$/"); // returns NULL

please?

thanks for those two who answered already - those would be the solutions for above.
But now i realised i need it a bit more complicated:
Not all ISRC's got GBCQV prefix, but i only need MAX from GBCQV prefix?
column ISRC
GBCQV0700378
SOME00125963
GBCQV0700382
GBCQV0700387

but i still need 00387 returned to me please

A:

SELECT MAX(SUBSTRING(ISRC, -5)) FROM digital_info WHERE LEFT(ISRC) = "GBCQV";

