Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: group by sorting
Cool!
How do you get the inverse of other non-numeric fields?
thanks,
ep
On 18 Oct 2000, at 6:20, Rod Corderey wrote:
Date sent: Wed, 18 Oct 2000 06:20:56 -0800 To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com> Send reply to: ORACLE-L_at_fatcity.com From: Rod Corderey <RodCorderey_at_lane-associates.com> Subject: Re: group by sorting
> As others have said , you can simply add an order by after the group by.
>
> Unless the group by is part of an inner query or inline view. In that case an order
> by is not allowed.
>
> The way to overcome this is to group by the necessary columns to satisfy the group
> functions but then add an overriding value to your group by to which you can apply
> a factor of -1,
>
> eg
> presuming that invoice_no is numeric
>
> then group by invoice_no, invoice_date
>
> becomes group by invoice_no*-1, to_number(to_char(invoice_date,'J')) * -1
>
> or something similar.
>
> the effect is to reverse the sort order of the group by.
Received on Wed Oct 18 2000 - 13:43:39 CDT