On 21-Apr-2004 Alex croes wrote:
> I'm trying to select specified data from a field in a table.
> The field from which the data has to come contains the following:  
> 'something;else;anything;everything;name;my' (and so on), it's a long
> text.
> 
> I need in the case just 'my' from the field, thus between the ';'.
> This 
> time there are only two characters, but I can't say by forehand how
> many 
> letters there will be.
> The only thing that's sure it comes after 'name', so I have the 
> following query:
> 
> SELECT SYS_IDX, LEFT(RIGHT(C, 
> LENGTH(C)-LOCATE(';',C,LOCATE('name',C))),10) FROM A;
> 
> This return's up to ten characters after the name, somethimes this is
> to 
> much, sometimes to many. Does anybody knows how to go from here.
> 

LEFT(SUBSTRING_INDEX(foo, ';', 1), 10)

Regards,
-- 
Don Read                                     [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to