I have the following table
code number
XY1 N2 2
A2 O1 3
KB11 2HG 2
XY2 J2 3
A1 X2 5
I need to select the substring from code until the first integer, i.e. XY1 N2 -> XY, and then aggregate and sum the numbers for these entries, i.e. for XY 2+3, and for A 5+3.
I tried
SELECT LEFT(code,position('(1|2|3|4|5|6|7|8|9|0)' in code)-1) FROM listing;
but it doesn't work. Any suggestions?