0

次のクエリに取り組んでいますが、COMPUTE にアクセスできません。

BREAK ON "Package ID" SKIP 2 on report
COMPUTE SUM OF "Package Cost" ON "Package ID"
COMPUTE SUM OF "Package Cost" ON REPORT;
Select distinct p.PkgID "Package ID", p.PkgName "Package Type", to_char(p.PkgCost,  '$99.99')"Package Cost", c.CustFName || ' ' || c.CustLName as "Customer Name" 
FROM Subscription s, Package p, Customer c
WHERE p.PkgID = s.PkgID
AND c.CustID = s.CustID     
AND trunc (s.startdate)=to_date('Oct 01, 2012', 'Mon DD, YYYY')
ORDER BY p.PkgID;

出力は次のようになります。

Package ID Package Type    Package Cost  Customer Name                                                                                                                                                  
---------- --------------- ------------- ---------------------------------------------------                                                                                                            
 10101 Movies Galore    $30.00       Frank Cinatra                                                                                                                                                  
       Movies Galore    $30.00       Krystal Carter                                                                                                                                                 
**********            -------------                                                                                                                                                                


 20202 News Globe       $30.00       Billy Joel                                                                                                                                                     
       News Globe       $30.00       Dia Nelson                                                                                                                                                     
       News Globe       $30.00       Rhonda Shields                                                                                                                                                 
**********            -------------                                                                                                                                                                


 30303 Total Watcher    $40.00       Frank McMann                                                                                                                                                   
       Total Watcher    $40.00       Orlando Magic                                                                                                                                                  
**********            -------------                                                                                                                                                                


 40404 Couch Potato     $50.00       Allan Bubbles                                                                                                                                                  
**********            -------------                                                                                                                                                                


                       -------------               

コストを計算できません。パッケージを細かく分割し、分割線を入れても、合計はありません。ラベルも付けません。ばかげたことを見逃しているだけですか?

4

1 に答える 1

0

データとしてサンプル テーブルを作成しました。

PACKAGE_ID PACKAGE_TYPE         PACKAGE_COST C_NAME             
---------- -------------------- ------------ --------------------
     10101 Movies_Galore                  30 Frank_Cinatra        
     10101 Movies_Galore                  30 Krystal_Carter       
     20202 News_Globe                     30 Billy_Joel           
     20202 News_Globe                     30 Dia_Nelson           
     20202 News_Globe                     30 RhondA_Shields       
     30303 Total_Watcher                  40 Frank_McMann         
     30303 Total_Watcher                  40 rlando_Magic         
     40404 Couch_Potato                   50 Allan_Bubbles    

SQL> break on package_id skip 1;
SQL> compute sum label 'package cost' of package_cost on package_id;
SQL> COLUMN package_cost FORMAT $99,99
SQL> select * from test;

PACKAGE_ID PACKAGE_TYPE         PACKAGE_COST C_NAME
---------- -------------------- ------------ --------------------
     10101 Movies_Galore                 $30 Frank_Cinatra
           Movies_Galore                 $30 Krystal_Carter
**********                      ------------
package co                               $60

     20202 News_Globe                    $30 Billy_Joel
           News_Globe                    $30 Dia_Nelson
           News_Globe                    $30 RhondA_Shields
**********                      ------------
package co                               $90


PACKAGE_ID PACKAGE_TYPE         PACKAGE_COST C_NAME
---------- -------------------- ------------ --------------------
     30303 Total_Watcher                 $40 Frank_McMann
           Total_Watcher                 $40 rlando_Magic
**********                      ------------
package co                               $80

     40404 Couch_Potato                  $50 Allan_Bubbles
**********                      ------------
package co                               $50
于 2013-08-23T04:36:59.427 に答える