(Our mail server just flaked out, so apologies if this is a
duplicate.)

That doesn't work for me (I get '12/15/03'), but I like the
way you think, pardner. How about:

SELECT
LEFT(SUBSTRING_INDEX(LEFT(log, LOCATE('Tested this', log)), '\n', -1), 8)
FROM test WHERE log like '%tested this%';

As mentioned by others in the thread, this is fine as a
stopgap, but you should change your table ASAP.

____________________________________________________________
Eamon Daly



----- Original Message ----- From: "Keith Ivey" <[EMAIL PROTECTED]>
To: <mysql@lists.mysql.com>
Cc: "Ed Reed" <[EMAIL PROTECTED]>
Sent: Thursday, March 24, 2005 3:53 PM
Subject: Re: a very tricky string extraction



Another possibility:

   SELECT SUBSTRING(log, LOCATE('\n', SUBSTRING(log, 1,
      LOCATE('Tested this', log)-1))+1, 8)
   FROM test WHERE LOCATE('Tested this', log);

--
Keith Ivey <[EMAIL PROTECTED]>
Smokefree DC
http://www.smokefreedc.org
Washington, DC



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



Reply via email to