RE: RE - Order By Problem

2004-06-11 Thread andy thomas
: Mysql List Subject: RE: RE - Order By Problem On Tue, 8 Jun 2004, Andy Eastham wrote: Look at using the Reverse() function, then take the substring up to the first space, then reverse the result. Well, 'select substring_index(surname,' ',-1) from advisers' does the trick as far

Re: RE - Order By Problem

2004-06-11 Thread andy thomas
- Order By Problem I have never done anything like this but after looking at the spec's I have a possible direction for you In String functions there is LOCATE(substr,str,pos) The first syntax returns the position of the first occurrence of substring substr in string str. The second syntax

Re: RE - Order By Problem

2004-06-11 Thread Michael Stassen
andy thomas wrote: snip Well, this was fixed in the end by this query: select substring_index(surname,' ',-1) as r from advisers order by r which produced the desired result. But we have since had complaints from individuals wanting their surnames sorted differently! People from Germany with

Re: RE - Order By Problem

2004-06-08 Thread andy thomas
On Tue, 8 Jun 2004, Paul McNeil wrote: I have never done anything like this but after looking at the spec's I have a possible direction for you In String functions there is LOCATE(substr,str,pos) The first syntax returns the position of the first occurrence of substring substr in

Re: RE - Order By Problem

2004-06-08 Thread Vadim P.
If surname is a field, then use it without the single quotes ('), otherwise it is treated as a literal string and 0 is the correct result: select locate(' ',surname,1) from advisers andy thomas wrote: Yes, this is the approach I was thinking of using but: select locate('

Re: RE - Order By Problem

2004-06-08 Thread andy thomas
On Tue, 8 Jun 2004, Vadim P. wrote: If surname is a field, then use it without the single quotes ('), otherwise it is treated as a literal string and 0 is the correct result: select locate(' ',surname,1) from advisers Thanks a lot, this is working. I now need to figure out how to use

RE: RE - Order By Problem

2004-06-08 Thread Andy Eastham
Look at using the Reverse() function, then take the substring up to the first space, then reverse the result. Andy -Original Message- From: Paul McNeil [mailto:[EMAIL PROTECTED] Sent: 08 June 2004 14:04 To: [EMAIL PROTECTED] Subject: RE - Order By Problem I have never done

RE: RE - Order By Problem

2004-06-08 Thread andy thomas
PROTECTED] Sent: 08 June 2004 14:04 To: [EMAIL PROTECTED] Subject: RE - Order By Problem I have never done anything like this but after looking at the spec's I have a possible direction for you In String functions there is LOCATE(substr,str,pos) The first syntax returns

RE: RE - Order By Problem

2004-06-08 Thread Andy Eastham
Andy, Just: select substring_index(surname,' ',-1) as r from advisers order by r; works. Andy -Original Message- From: andy thomas [mailto:[EMAIL PROTECTED] Sent: 08 June 2004 15:57 To: Andy Eastham Cc: Mysql List Subject: RE: RE - Order By Problem On Tue, 8 Jun 2004, Andy

Re: RE - Order By Problem

2004-06-08 Thread Michael Stassen
work? Thanks for your help, Andy -Original Message- From: Paul McNeil [mailto:[EMAIL PROTECTED] Sent: 08 June 2004 14:04 To: [EMAIL PROTECTED] Subject: RE - Order By Problem I have never done anything like this but after looking at the spec's I have a possible direction for you In String