Untitled
unknown
plain_text
2 years ago
587 B
4
Indexable
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;
Editor is loading...