Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Using TO_CHAR With Subtraction and AVG Function

Re: Using TO_CHAR With Subtraction and AVG Function

From: <ITAnnaJones_at_gmail.com>
Date: 19 Dec 2006 06:49:23 -0800
Message-ID: <1166539763.064195.49120@i12g2000cwa.googlegroups.com>


Thank you so much, that worked great.

Would Group By have worked?

Michel Cadot wrote:
> <ITAnnaJones_at_gmail.com> a écrit dans le message de news: 1166504708.311640.279470_at_73g2000cwn.googlegroups.com...
> |I am trying to show a list of invoice numbers, with each invoice total
> | formatted as currency, then the average of all of the invoices
> | formatted as currency, then the diff between the two formatted as
> | currency. Below is what I have so far, but I cannot get it to work! Any
> | assistance is appreciated.
> |
> | Thanks!
> |
>
> SELECT INV_NUMBER,
> TO_CHAR(LINE_UNITS*LINE_PRICE,'$99,999.99') AS "INVOICE TOTAL",
> TO_CHAR(AVG(LINE_UNITS*LINE_PRICE) over (partition by inv_number), '$99,999.99') AS "AVG INVOICE
> AMT",
> TO_CHAR((LINE_UNITS*LINE_PRICE) - (AVG(LINE_UNITS*LINE_PRICE) over (partition by inv_number)),
> '$99,999.99') AS "DIFF"
> FROM LINE
> /
>
> Regards
> Michel Cadot
Received on Tue Dec 19 2006 - 08:49:23 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US