I have a value placed into a varchar field in Mysql. I need to perform a query to parce a certain element of the string. For example:
I need to extract the value 23456 to as a "column" in a select query. The delimiter should be the "_", not count the number of characters to 23456 because the FILE_.... could be FILESTODAY_...., thus throwing off a character count.
I provided the sql select I am using, but it produces:
as the output, where I only want 23456.
I would like to know if I can do this in a single select statement.
500 points. I think it is easy, I am just missing something.
select fname, substring_index(fname, '_',4) as mybatchno, substring_index(fname, '_', -3) as xmybatchno