Untitled
unknown
plain_text
2 months ago
587 B
1
Indexable
Never
SELECT CASE WHEN INSTR(your_column, '.') > 0 THEN -- If a period '.' exists, extract the two digits before the second to last occurrence of '_' SUBSTR( your_column, INSTR(your_column, '_', -1, 2) - 2, 2 ) ELSE -- If no period '.' exists, take the two digits before the second to last occurrence of '_' SUBSTR( your_column, INSTR(your_column, '_', -1, 2) - 2, 2 ) END AS result FROM your_table;