Re: Re: Newbie Questions
| From: | Torsten Roehr | Date: | Sat, 04 Sep 2004 19:31:56 +0000 |
| Subject: | Re: Re: Newbie Questions | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-36042@lists.php.net to get a copy of this message | ||
> > "SELECT firstname, lastname, address FROM TABLENAME ORDER BY lastname
ASC";
> >
> > Use ASC or DESC to order your query results. When you
> > iterate over the result as Torsten indicated, everything
> > will be in the order you specify.
>
> In the database table itself, right? Does it make more
> sense to do that than to leave the database alone, read it
> into an array and then sort it anyway I want (there will be
> at least two different sorted lists I want it to produce)?
Sorting in the database should always be the preferred way - should be
quicker than doing it in the application in 9 out of 10 times.
Regards, Torsten Roehr