home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.oracle      Overblown overpriced overengineered SHIT      2,288 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 1,149 of 2,288   
   UNIXNewBie to All   
   rollup not working   
   25 Feb 04 19:02:29   
   
   From: nospan@nospam.com   
      
   Am looking at an Oracle SQL reference book.   
      
   They have the following SQL for ROLLUP which works   
      
   SELECT 0.YEAR, TO_CHAR(TO_DATE(O.MONTH, 'MM'), 'Month') MONTH,   
      
   R.NAME REGION, SUM(O.TOT_SALES)   
      
   FROM ORDERS O, REGION R   
      
   WHERE R.REGION_ID = O.REGION_ID   
      
   AND O.MONTH BETWEEN 1 AND 3   
      
   GROUP BY ROLLUP (O.YEAR, O.MONTH, R.NAME)   
      
      
   They also have the following SQL which apparently is supposed to produce a   
   partial ROLLUP. It does not work however. I receive ORA-00933: SQL command   
   not properly ended.   
      
   Why is this happening?   
      
   Note that the only difference is that O.YEAR is now outside the ROLLUP   
      
      
   SELECT O.YEAR, TO_CHAR(TO_DATE(O.MONTH, 'MM'), 'Month') MONTH,   
      
   R.NAME REGION, SUM(O.TOT_SALES)   
      
   FROM ORDERS O, REGION R   
      
   WHERE R.REGION_ID = O.REGION_ID   
      
   AND O.MONTH BETWEEN 1 AND 3   
      
   GROUP BY O.YEAR, O.MONTH ROLLUP (R.NAME)   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca