|
[MYSQL] estrarre stringa costituita da 4 numeri adiacenti
Buongiorno a tutti,
ho necessità di costruire una query per estrarre una sottostringa costituita da 4 numeri adiacenti. Esempio:
"AB-1-2345abc" => 2345
"1234abchda" => 1234
"1-2345-678" => 2345
La posizione dei 4 numeri all'interno della stringa non è conosciuta, l'unica cosa nota è che sono sempre 4 numeri adiacenti.
La query dovrebbe essere qualcosa di questo tipo:
select SUBSTRING (colonna, posizione, 4) as risultato from tabella
Non riesco a capire come ottenere la posizione di 4 numeri adiacenti nella stringa. Consigli?
__________________
CASE:Cooler Master Mastercase pro5 MB:Asus Maximus VIII hero CPU:i7 6700k RAM:Corsair platinum 16Gb DDR4 3000Mhz VGA:msi gtx 1080 gaming x AUDIO:Creative sound blaster Z SSD:2 x Samsung 850 evo 256Gb HD:WD 2Tb black PSU:Corsair hx850i CPU COOLER:Corsair h100i V2 HEADSET:Sennheiser Game one
Origin: GSGames18
|