Re: Sorting Fields with varchar and Int
| From: | PHPWIN | Date: | Wed, 11 Oct 2000 17:09:21 +0000 |
| Subject: | Re: Sorting Fields with varchar and Int | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-3173@lists.php.net to get a copy of this message | ||
actually i sorted by using this:
$sql="select * from table where field like '%".$this."%'
order by field+0,field+'' ";
works by sorting the field which is a varchar() by number then as a string
again
however cant seem to get round the string bit
coz I want to sort by the number 1,2,3.... first then followed by a,b,c...
Thanx
Xon
----- Original Message -----
From: "Zak Greant" <zak@php.net>
To: "PHPWIN" <phpwin@hotmail.com>
Cc: <php-windows@lists.php.net>
Sent: Thursday, October 12, 2000 2:27 AM
Subject: Re: [PHP-WIN] Sorting Fields with varchar and Int
> order by field_name
>
> --zak
>
> At 07:23 PM 10/11/00 +0800, PHPWIN wrote:
> >Hi
> > Does anyone know how to sort these columns in MySql from
> >+------+
> > I 1b I
> >+------+
> > I 1c I
> >+------+
> > I 2b I
> >+------+
> > I 1a I
> >+------+
> > I 2a I
> >+------+
> >
> >to this
> >+------+
> > I 1a I
> >+------+
> > I 1b I
> >+------+
> > I 1c I
> >+------+
> > I 2b I
> >+------+
> > I 2a I
> >+------+
> >
> >if the fields are varchar()
> >
> >cheers
> >Xon
>
>