List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:December 27 1999 3:17pm
Subject:Re: The simplest way
View as plain text  
At 2:02 PM +0100 1999-12-27, Ludovic Cellier wrote:
>Paul DuBois wrote:
>
>>  At 10:11 AM +0100 1999-12-27, Ludovic Cellier wrote:
>>  >Hello all !
>>  >
>>  >I would like to know what is simplest way to sort a table by one of the
>>  >column.
>>  >I need to keep the same table name, the same columns and the same data.
>>
>>  Use an ORDER BY clause in your SELECT statement when you retrieve rows
>>  from the table.
>>
>>  --
>>  Paul DuBois, paul@stripped
>
>I don't want to sort the result of a select statement.
>I want to sort the datas IN the table.

That's not how relational databases work.  They make no guarantee about
the order of rows in a table.  That's what the ORDER BY clause is for.

>so if I just do a   select * from thetable ;
>It gives me all the data, sorted.
>
>For the moment I have only one solution, but i'm looking for another.
>Create a tempory table, copy all the data sorted in that new table
>delete datas from the first one and pour it again from the temporary.

That works, but only as an accident of the current implementation.
As soon as you start deleting and inserting rows, you'll need to
do it again.

-- 
Paul DuBois, paul@stripped
Thread
The simplest wayLudovic Cellier27 Dec
  • Re: The simplest wayPaul DuBois27 Dec
  • Re: The simplest wayLudovic Cellier27 Dec
    • Re: The simplest wayPaul DuBois27 Dec
  • Re: The simplest wayjens27 Dec
    • Re: The simplest waysinisa28 Dec
      • Re: The simplest wayhypnos29 Dec
        • Re: The simplest waysinisa29 Dec