I am using MySQL 4.1.21 (win 32) on Windows 7.
I have a field called “path” in table “test”
some rows look like following:
/date/sunday/morning/
/date/sunday/morning/9
/date/wednesday/morning/11
/date/monday/morning/10
/date/monday/afternoon/
/date/friday/wholeday/10/pm
…etc.
I want to get all days after /date/ till the next ‘/’ starts for example: sunday or wednesday or morning as the results.
thank you-
You can use MySQL’s
SUBSTRING_INDEX()function, together with a filter based on a pattern match:See it on sqlfiddle.