I have the following in a sql query:
SELECT field1, field2, ... substring_index(file_name, '.', -1)
FROM table
I use this function quite frequently to grab the extension so I'd just like to extract that to a function. How would I do that in mysql? So far I have something like:
CREATE PROCEDURE get_extension(field VARCHAR)
returns VARCHAR
SUBSTRING_INDEX(field, '.', -1)