David Ruggles schrieb:
I have googled, read the mysql documentation and searched the list archive.
I don't know if I just don't know the correct term to use or if I have some
other problem.

In a nutshell I generate packing lists where the items are normally sorted
alphabetically. However, there is one type of item that always gets loaded
first. I would like for any of these items to always be at the top of the
list. Here's the classic animal example:

Given:
+----------+---------+------------+
| name     | species | birth      |
+----------+---------+------------+
| Chirpy   | bird    | 1998-09-11 |
| Whistler | bird    | 1997-12-09 |
| Claws    | cat     | 1994-03-17 |
| Fluffy   | cat     | 1993-02-04 |
| Fang     | dog     | 1990-08-27 |
| Bowser   | dog     | 1989-08-31 |
| Buffy    | dog     | 1989-05-13 |
| Puffball | hamster | 1999-03-30 |
| Slim     | snake   | 1996-04-29 |
+----------+---------+------------+

I want hamsters to always sort out first, but still have everything else in
alphabetical order
Like this:
+----------+---------+------------+
| name     | species | birth      |
+----------+---------+------------+
| Puffball | hamster | 1999-03-30 |
| Chirpy   | bird    | 1998-09-11 |
| Whistler | bird    | 1997-12-09 |
| Claws    | cat     | 1994-03-17 |
| Fluffy   | cat     | 1993-02-04 |
| Fang     | dog     | 1990-08-27 |
| Bowser   | dog     | 1989-08-31 |
| Buffy    | dog     | 1989-05-13 |
| Slim     | snake   | 1996-04-29 |
+----------+---------+------------+

you need to add an additional field like 'priority' and do "ORDER BY priority DESC, species ASC"

--
Sebastian

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to