Re: a very tricky string extraction

2005-03-24 Thread Eamon Daly
To: 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)

Re: a very tricky string extraction

2005-03-24 Thread Ed Reed
FROM test WHERE log LIKE '%tested this%' Don't try this at home. Eamon Daly - Original Message - From: "Ed Reed" < [EMAIL PROTECTED] > To: < mysql@lists.mysql.com > Sent: Thursday, March 24, 2005 3:37 PM Subje

Re: a very tricky string extraction

2005-03-24 Thread Keith Ivey
Eamon Daly wrote: SELECT LEFT(SUBSTRING_INDEX(LEFT(log, LOCATE('\n', log, LOCATE('tested this', log)) - 1), '\n', -1), 8) FROM test WHERE log LIKE '%tested this%' Another possibility: SELECT SUBSTRING(log, LOCATE('\n', SUBSTRING(log, 1, LOCATE('Tested this', log)-1))+1, 8) FROM test WH

Re: a very tricky string extraction

2005-03-24 Thread Eamon Daly
iginal Message - From: "Ed Reed" <[EMAIL PROTECTED]> To: Sent: Thursday, March 24, 2005 3:37 PM Subject: Re: a very tricky string extraction Thanks Shawn, The idea I've been working with on this is to use an InStr to find the point where the require substring appears.

Re: a very tricky string extraction

2005-03-24 Thread Ed Reed
Thanks Shawn, The idea I've been working with on this is to use an InStr to find the point where the require substring appears. Then I need to search backwards from there to the point where the first \n\r is found. Then the Date that I want would be 8 characters from that position. The obvious pr

Re: a very tricky string extraction

2005-03-24 Thread SGreen
"Ed Reed" <[EMAIL PROTECTED]> wrote on 03/24/2005 04:02:28 PM: > Sorry everyone for not being more clear. The field IS in a multiline > varchar field. The example data was all from one record in the table. > > Unfortunately, this is a database that has been around for many years > and backward co

Re: a very tricky string extraction

2005-03-24 Thread Ed Reed
Sorry everyone for not being more clear. The field IS in a multiline varchar field. The example data was all from one record in the table. Unfortunately, this is a database that has been around for many years and backward compatibility with other apps limits redesigning the table. It is a Comment

Re: a very tricky string extraction

2005-03-24 Thread SGreen
"Ed Reed" <[EMAIL PROTECTED]> wrote on 03/24/2005 02:49:30 PM: > This is an interesting problem that I hope someone can help me with. I > have a varchar field that contains data like this, > > 01/01/05 SG Reviewed this > 12/15/03 DSD Reviewed that > 10/24/02 EWW Worked on that and tested this th

RE: a very tricky string extraction

2005-03-24 Thread Jay Blanchard
[snip] [snip] 01/01/05 SG Reviewed this 12/15/03 DSD Reviewed that 10/24/02 EWW Worked on that and tested this then stop to do something else 05/02/01 AW Did something 08/31/98 DSD Tested this 07/22/97 EWW Worked on that and did something I need a Select statement that returns the Date for the

RE: a very tricky string extraction

2005-03-24 Thread Jay Blanchard
[snip] 01/01/05 SG Reviewed this 12/15/03 DSD Reviewed that 10/24/02 EWW Worked on that and tested this then stop to do something else 05/02/01 AW Did something 08/31/98 DSD Tested this 07/22/97 EWW Worked on that and did something I need a Select statement that returns the Date for the first o

Re: a very tricky string extraction

2005-03-24 Thread Keith Ivey
Dan Nelson wrote: How about: SELECT LEFT(description, 8) FROM mytable WHERE description LIKE "%tested this%" LIMIT 1 Hmm, I assumed he was talking about a multi-line VARCHAR, but now that I look again Dan's interpretation is probably the right one. My previous message doesn't apply (except for t

Re: a very tricky string extraction

2005-03-24 Thread Joerg Bruehe
Ed, let me put it in a "politically incorrect", blunt way: Am Do, den 24.03.2005 schrieb Ed Reed um 20:49: > This is an interesting problem that I hope someone can help me with. I > have a varchar field that contains data like this, > > 01/01/05 SG Reviewed this > 12/15/03 DSD Reviewed that >

Re: a very tricky string extraction

2005-03-24 Thread Keith Ivey
Ed Reed wrote: 01/01/05 SG Reviewed this 12/15/03 DSD Reviewed that 10/24/02 EWW Worked on that and tested this then stop to do something else 05/02/01 AW Did something 08/31/98 DSD Tested this 07/22/97 EWW Worked on that and did something I need a Select statement that returns the Date for the

Re: a very tricky string extraction

2005-03-24 Thread Dan Nelson
In the last episode (Mar 24), Ed Reed said: > This is an interesting problem that I hope someone can help me with. I > have a varchar field that contains data like this, > > 01/01/05 SG Reviewed this > 12/15/03 DSD Reviewed that > 10/24/02 EWW Worked on that and tested this then stop to do somet

a very tricky string extraction

2005-03-24 Thread Ed Reed
This is an interesting problem that I hope someone can help me with. I have a varchar field that contains data like this, 01/01/05 SG Reviewed this 12/15/03 DSD Reviewed that 10/24/02 EWW Worked on that and tested this then stop to do something else 05/02/01 AW Did something 08/31/98 DSD Tested