Thanks Guys for you insights.

It may be a little more complicated then I made it out to be.

I have tried this select substring_index(myfiled,'.',-2) from mytable.
 This has gotten me to a good starting point.

But I still have two problems.  After the extension there is a space
and more wording.  I want to cut that off.  Also, some paths do not
have an extension and I am trying to ignore those.  So simply.  I am
just trying to pull out the file extension but there were some
conditions I did not list.

-Aaron

>
> SUBSTRING_INDEX should do what you want.
>
> SELECT SUBSTRING_INDEX('myfile.path','.',-1)
> => 'path'
>
> SELECT SUBSTRING_INDEX('myfile.pth','.',-1)
> => 'pth'
>
> or, in a version that's closer to real life usage:
>
> SELECT SUBSTRING_INDEX(myfield,'.',-1) from mytable
>
> http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_substring-index
>
> Mark
> --
> http://mark.goodge.co.uk

>

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to