Re: Sorting Varchar

2004-05-13 Thread Bill Easton
definition. For Pasha's solution to work, you would need to have the text_val column be null (or '') when the value is numeric. Subject: Re: Sorting Varchar From: [EMAIL PROTECTED] Date: Wed, 12 May 2004 18:13:17 -0400 That didn't do it. I got 0,0,1050,1168,1195, 1975, 150,155,16500,170,178

RE: Sorting Varchar

2004-05-13 Thread Erich Beyrent
OK, I'm sorry. The solution I gave doesn't work. You need to have some sort of conditional in the sort expression so that numbers are sorted numerically and other things are sorted alphanumerically. I'm not aware of a test for numeric vaues in MySql, so you need to use some trick to

Re: Sorting Varchar

2004-05-13 Thread kc68
definition. For Pasha's solution to work, you would need to have the text_val column be null (or '') when the value is numeric. Subject: Re: Sorting Varchar From: [EMAIL PROTECTED] Date: Wed, 12 May 2004 18:13:17 -0400 That didn't do it. I got 0,0,1050,1168,1195, 1975, 150,155,16500,170,178

Fw: Sorting Varchar

2004-05-12 Thread Bill Easton
You could also use order by cost+0,cost. This puts the non-numerics first, then the numerics in numerical order. (You'd need to get fancier if there are non-numerics starting with a digit or numerics = 0.) From: Sasha Pachev [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: How do I set

Re: Sorting Varchar

2004-05-12 Thread kc68
That didn't do it. I got 0,0,1050,1168,1195, 1975, 150,155,16500,170,178. . . The non-numerics came out last (which I want). There are two zeros but no negative numbers. Any alternatives? Ken ** On Wed, 12 May 2004 07:47:11 -0400, Bill Easton [EMAIL PROTECTED] wrote: You could also

Sorting Varchar

2004-05-11 Thread kc68
How do I set up a column (cost) that contains numbers and text so that the numbers will sort the numbers accurately? Using varchar results in a sort based on the first digit, so that I get e.g. 1, 10, 100, 3. . . when the command is order by cost. Almost all of the text is By County. Ken --

Re: Sorting Varchar

2004-05-11 Thread Sasha Pachev
[EMAIL PROTECTED] wrote: How do I set up a column (cost) that contains numbers and text so that the numbers will sort the numbers accurately? Using varchar results in a sort based on the first digit, so that I get e.g. 1, 10, 100, 3. . . when the command is order by cost. Almost all of the