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

Home -> Community -> Usenet -> c.d.o.server -> Single SQL Statement....

Single SQL Statement....

From: <xyzer_at_samsung.co.kr>
Date: 1998/02/17
Message-ID: <34E8B5F9.F12449F4@samsung.co.kr>#1/1

Hi SQL-Gurus,

I have an odd query requirement that I am struggling with approaches to. I'm not even sure what to call this type of query? Here's hoping someone can help... Lets say we have the following table...

The table has this layout:

sequence# restaurant_ID item_id item_cost


    1                            A             1       10
    2                            A             1       10
    3                            A             2       10
    4                            B             1       10
    5                            B             2       10
    6                            B             2       10


The result output should have this layout:

[summary table]

restaurant_ID sum(item_1_cost) sum(item_2_cost)


  A                                   20             10
  B                                   10             20

How can this be done in only one statement? This seems like it should be so simple but for the life of me, I cannot seem to figure it out. Could you write it.. in a single SQL-statement? Any help would be greatly appreciated.

Sungkwan Park
MCSE, MCSD
mcse_at_inote.com
ORACLE_at_korea.com
82-343-98-5680 Received on Tue Feb 17 1998 - 00:00:00 CST

Original text of this message

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