order by with group by

order by with group by

am 07.05.2006 14:43:02 von Ike

If I have a GROUP BY statement, which groups my multiple fields, e.g.:

SELECT ......GROUP BY date, store

can I have multiple ORDER BY statements with that? e.g.:

SELECT ......GROUP BY date, store ORDER BY date asc, store, desc

Is this an acceptable syntax? Thanks, Ike

Re: order by with group by

am 09.05.2006 19:35:30 von Bill Karwin

Ike wrote:
> SELECT ......GROUP BY date, store ORDER BY date asc, store, desc
>
> Is this an acceptable syntax? Thanks, Ike

Yes, that's the idea, except your statement has an extra comma. You
should use the following:

ORDER BY date asc, store desc

Regards,
Bill K.