| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL ENQUIRIES!
In article <7443he$aia$1_at_ash.prod.itd.earthlink.net>,
  "Kenny Lim" <Kennylim_at_earthlink.net> wrote:
> Hi,
>
> I am kinda stuck here trying to create a row below every invoices
> number spaced and totaled. Therefore will be able to get a
> summary overview of the report. Does anyone know how to
> do it ? Please Advise.
>
> Thanks in Advance.
>
> Regards,
>
> Ken
>
> select invoice_id,
> menu_id,
> description,
> quantity,
> (price * quantity) as subtotal,
> (price*quantity * 0.085) as tax,
> (price*quantity * 0.085+price*quantity) as total
> from menus;
> where invoice_id = invoice_id
> and menu_id = menu_id;
>
> Result : (HOW DO I GET A TOTAL SUMMARIZED AT THE END OF EVERY INVOICES?!)
>
> INVOICE_ID   MENU_ID  DESCRIPTION                QUANTITY  SUBTOTAL   TAX
> TOTAL
> ----------        ---------          -------------------------      --------
> -      ---------      -----  -----
>       1001         1   Peking Spareribs                          1
> 9            .    77    9.8
>
>       1002         2  Peking Duck                                 1
> 7                .60    7.6
>
>       1003         3  Walnut Shrimp                               2
> 16               1.36   17.4
>
>       1004         4   Kung Pao Chicken                        1
> 7                .60    7.6
>
>       1005         4   Kung Pao Chicken                         1
> 7                .60    7.6
>       1005         5   Szechuan Chicken                         1
> 7                .60    7.6
>
> 6 rows selected.
>
>
By using Oracle*Reports, Discoverer or MS-Excel. Don't torture the tool which wasn't written for writing reports with doing so. Another good idea would be to use PL/SQL and dbms_output to generate such a report or server side Java (system.util.println should be helpful here!). Perl is another solution, because it's format specifiers make it possible to write nice reports. To make a long story short, there are about 1,000,000.00 alternatives, the worst of which is SQL*Plus.
--
Mladen Gogala
-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Wed Dec 02 1998 - 20:13:25 CST
![]()  | 
![]()  |