List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:June 21 2000 2:47am
Subject:Re: Query format question.
View as plain text  
At 9:40 PM -0500 2000-06-20, John W. Holmes wrote:
>Ok. Say I've got the following table:
>
>+-----+------------+
>| ID  | Name       |
>+-----+------------+
>|   0 | None       |
>|   1 | Undecided  |
>|   2 | Enhanced   |
>|   3 | Premium    |
>| 101 | Leaves     |
>| 102 | Gardening  |
>| 103 | Architect1 |
>| 104 | Architect2 |
>+-----+------------+
>
>Can I use one select statement to always give me id 0-3 in the 4 first rows
>returned, then return the the rows with ids over 100 in alphabetical order,
>by name? Basically anything under 100 I want returned in the actual order
>the rows are in the databases, but anything over 100, I want alphabatized. I
>know I can do it with two select statements, but can I do it with one?


Nope.  You're asking for different sort orders over different parts of
the result set.


Also, "the actual order the rows are in the database" has no meaning
really.  You don't know what order MySQL stores the rows, and it is allowed
to return the rows in any order unless you specify an ORDER BY clause.

-- 
Paul DuBois, paul@stripped
Thread
Query format question.John W. Holmes21 Jun
  • Re: Query format question.Paul DuBois21 Jun
Re: Query format question.tech - internet emporium21 Jun