add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
WITH yourTable AS (
SELECT 1 AS id, 'AB.1234.cd' AS string UNION ALL
SELECT 2, 'EF.5678.gh'
)

SELECT id, string, SUBSTRING_INDEX(SUBSTRING_INDEX(string, '.', -2), '.', 1) AS output
FROM yourTable;










id string output
1 AB.1234.cd 1234
2 EF.5678.gh 5678