Re: order by problem
| From: | guslist at kerntec dot net | Date: | Thu, 21 Mar 2002 12:00:56 +0000 |
| Subject: | Re: order by problem | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-17795@lists.php.net to get a copy of this message | ||
Thank you all for the Tip ! It work´s fine now !! :)
Gus
----- Original Message -----
From: <urosh@agenda.si>
To: <guslist@kerntec.net>
Cc: <php-db@lists.php.net>
Sent: Wednesday, March 20, 2002 10:32 AM
Subject: Re: [PHP-DB] order by problem
> On Wed, 20 Mar 2002 guslist@kerntec.net wrote:
>
> You have your ctrlnumber field defined as varchar. If you define
> ctrlnumber as number, you could also use
>
> SELECT max(ctrlnumber) FROM table WHERE id=14;
>
> Cheers
> Urosh
>
> > Hello All,
> >
> > I´m having a 'problem' that I dont know how to resolve. The problem is:
> >
> > I have a table that I want to get the last number to increment. To do
this I
> > want to sort the filed 'ctrlnumber'. Using this query´s I get:
> > mysql> SELECT ctrlnumber FROM table WHERE id=14;
> > +------------+
> > | ctrlnumber |
> > +------------+
> > | 7 |
> > | 1 |
> > | 2 |
> > | 3 |
> > | 4 |
> > | 5 |
> > | 6 |
> > | 8 |
> > | 9 |
> > | 10 |
> > | 11 |
> > +------------+
> > 11 rows in set (0.00 sec)
> >
> > mysql> SELECT ctrlnumber FROM table WHERE id=14 order by ctrlnumber;
> > +------------+
> > | ctrlnumber |
> > +------------+
> > | 1 |
> > | 10 |
> > | 11 |
> > | 2 |
> > | 3 |
> > | 4 |
> > | 5 |
> > | 6 |
> > | 7 |
> > | 8 |
> > | 9 |
> > +------------+
> > 11 rows in set (0.01 sec)
> >
> >
> > When I try to sort, it doesn´t return to me in the order that I need (1
2 3
> > 4 5 6 7 8 9 10 11). Is there a way to do this or I´ll have to include 01
02
> > 03 04 05.... to all my recoreds ?
> >
> > Thank´s in advance,
> > Gus
> >
> >
> >
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>