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?
Perhaps it would help to point out that the order of a GROUP BY is
irrelevent. You simply group on a set of columns. Therefore, your
query could be re-written as
SELECT some_stuff
FROM table
WHERE some_conditions
GROUP BY 5, 4, 2, 3, 1
ORDER BY 5, 4, 2, 3
--June
---- June Tong Informix Software ----
---- Senior Consultant (650) 926-6140 ----
---- International Support junet@informix.com ----
---- Location-du-jour: Menlo Park ----