InStrRev

Im trying to get a result to return only the paths out of my hard drive, through a database, I have imported all files on my hard drive into the database.

When I query through Access I use:-
     SELECT Left([path],InStrRev([path],"\")) AS Expr1
     FROM scanned
     GROUP BY Left([path],InStrRev([path],"\"));
and get 40 rows back, whatever I try in MySql I only get half the rows back. I know my probelm is cause MySql doesnt support 'InStrRev', but cant see any similar functions.

I have tried to make my own instrrev like this "length(`path`) - INSTR(reverse(`path`),"\\"))) "

InstrRev is the same as instr, but returns the last value in the string, instead of where it found it first.
tonelm54Asked:
Who is Participating?
 
mssturgeonCommented:
oops, slight revision:

     SELECT REVERSE( SUBSTRING( REVERSE([path]), INSTR(REVERSE([path]), "\\")+1) AS Expr1
     FROM scanned
     GROUP BY Expr1;
0
 
mssturgeonCommented:
Try this:
     SELECT REVERSE( SUBSTRING( REVERSE([path]), LOCATE("\\")+1) AS Expr1
     FROM scanned
     GROUP BY Expr1;
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.