Re: UPDATE string segment?

2004-09-02 Thread Michael Stassen
That's a little trickier. You can use SUBSTRING_INDEX() to split a string on the Nth '/', but N will vary with path length. With N = -1, though, we'll get the piece after the last '/' (the filename). Then we could replace that with nothing in the original string. That is, something like

UPDATE string segment?

2004-09-01 Thread John Mistler
I have a column that holds hard disk file location info such as: /Volumes/External HD/aFolder/aFile.pdf /Volumes/External HD/aFolder/anotherFile.pdf etc. . . (many files located in the same folder) Can anyone suggest a single statement (or multiple) that would update every file location located

Re: UPDATE string segment?

2004-09-01 Thread Michael Kruckenberg
You can use the replace string function: update table set file_path=replace(file_path,'aFolder','aFolder/aChildFolder'); In each update aFolder will be replaced by the new path. John Mistler wrote: I have a column that holds hard disk file location info such as: /Volumes/External

Re: UPDATE string segment?

2004-09-01 Thread John Mistler
Wow! That works. Thanks a bunch! While we're at it, I have one more hang-up: Is there a (DISTINCT?) statement that will select the distinct folder path(s) of every entry in the table? For instance, if I have three files: /Volumes/External HD/aFolder/aFile.pdf /Volumes/External