Re: strange order by problem

2005-09-27 Thread Hassan Schroeder
Claire Lee wrote: > This simplified my second expression in the if > statement. Thank you. But the query still doesn't sort > by the numbers, here's the result: > > mysql> select distinct secname, date from optresult > where secname like 'swap%' a > nd date like '2005-09-2%' order by if (secname l

Re: strange order by problem

2005-09-27 Thread Claire Lee
This simplified my second expression in the if statement. Thank you. But the query still doesn't sort by the numbers, here's the result: mysql> select distinct secname, date from optresult where secname like 'swap%' a nd date like '2005-09-2%' order by if (secname like 'swap%',abs(substring(secnam

Re: strange order by problem

2005-09-27 Thread 2wsxdr5
[EMAIL PROTECTED] wrote: Claire Lee <[EMAIL PROTECTED]> wrote on 09/27/2005 03:48:11 PM: I need to order a few names by the number following the main name. For example swap2, swap3, swap10 in the order of swap2, swap3, swap10, not in swap10, swap2, swap3 as it will happen when I do an order

Re: strange order by problem

2005-09-27 Thread Hassan Schroeder
Claire Lee wrote: > I need to order a few names by the number following > the main name. For example swap2, swap3, swap10 in the > order of swap2, swap3, swap10, not in swap10, swap2, > swap3 as it will happen when I do an order by. ... ORDER BY ABS(SUBSTRING(secname,5)) ... will insure tha

Re: strange order by problem

2005-09-27 Thread SGreen
Claire Lee <[EMAIL PROTECTED]> wrote on 09/27/2005 03:48:11 PM: > I need to order a few names by the number following > the main name. For example swap2, swap3, swap10 in the > order of swap2, swap3, swap10, not in swap10, swap2, > swap3 as it will happen when I do an order by. > > So I came up w

RE: strange order by problem

2005-09-27 Thread Gordon Bruce
(0.00 sec) -Original Message- From: Claire Lee [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 27, 2005 2:48 PM To: mysql@lists.mysql.com Subject: strange order by problem I need to order a few names by the number following the main name. For example swap2, swap3, swap10 in the order o

strange order by problem

2005-09-27 Thread Claire Lee
I need to order a few names by the number following the main name. For example swap2, swap3, swap10 in the order of swap2, swap3, swap10, not in swap10, swap2, swap3 as it will happen when I do an order by. So I came up with the following query: mysql> select distinct secname, date from optresult