Re: Fields in ORDER BY and GROUP BY in different order
Posted in 1998
Ian Clark wrote:
> SELECT some_stuff
> FROM table
> WHERE some_conditions
> GROUP BY 1, 2, 3, 4, 5
> ORDER BY 5, 4, 2, 3>
> Can anyone explain how this can be and perhaps show a simple example
> to illustrate?
What's your problem with this statement? GROUP BY and ORDER BY are
completely independent on each other. Your query will group the
result set by the specified columns (thus eliminating multiple
identical rows or allowing aggregates), and the result will be
ordered by the specified columns.
HTH, Richard
--
+--------------------------+------------------------------------------+
| Dr. Richard Spitz | INTERNET: spitz@ana.med.uni-muenchen.de |
| EDV-Gruppe Anaesthesie | Tel : +49-89-7095-3413 |
| Klinikum Grosshadern | FAX : +49-89-7095-8886 |
| 81366 Munich, Germany | GSM : +49-172-8933578 |
+--------------------------+------------------------------------------+