SQL to select filename component of path

The following works on MySQL to extract base filename component of a complete file path.

SELECT REVERSE(
  SUBSTRING(
    REVERSE(filepath),1,
      LOCATE("/",REVERSE(filepath)
    ) - 1
 )
) as basename
FROM Table
tags:   #misc

<< previous
Design Idea
^ Up ^
Blog Index
next >>
Stance Robot v2
email info@jgstechnical.com
phone +1 814.359.9317 USA