If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Group by rollup problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-27-10, 11:39
WindInFace WindInFace is offline
Registered User
 
Join Date: Mar 2010
Posts: 7
Group by rollup problem

Hi,

We're using DB2 Z/OS version 8.

When I try using GROUP BY ROLLUP this code returns the error
SQLCODE = -440, ERROR: NO ROLLUP BY THE NAME HAVING COMPATIBLE ARGUMENTS WAS FOUND IN THE CURRENT PATH

Code:
WITH my_table AS (
	 SELECT 'A' MY_GROUP FROM SYSIBM.SYSDUMMY1
	 UNION ALL
	 SELECT 'B' MY_GROUP FROM SYSIBM.SYSDUMMY1
	 UNION ALL
	 SELECT 'B' MY_GROUP FROM SYSIBM.SYSDUMMY1
	 UNION ALL
	 SELECT 'C' MY_GROUP FROM SYSIBM.SYSDUMMY1
	 UNION ALL
	 SELECT 'C' MY_GROUP FROM SYSIBM.SYSDUMMY1
	 UNION ALL
	 SELECT 'C' MY_GROUP FROM SYSIBM.SYSDUMMY1
)
SELECT COUNT(MY_GROUP) COUNT, MY_GROUP
FROM my_table
GROUP BY  ROLLUP (MY_GROUP)
However removing ROLLUP and using GROUP BY (MY_GROUP) works fine, but of course I don't get the total.

Last edited by WindInFace; 04-27-10 at 11:48.
Reply With Quote
  #2 (permalink)  
Old 04-27-10, 13:42
tonkuma tonkuma is offline
Registered User
 
Join Date: Feb 2008
Location: Japan
Posts: 2,193
Looking into manuals("DB2 Universal Database for z/OS SQL Reference Version 8" and "DB2 Version 9.1 for z/OS SQL Reference"),
DB2 for z/OS don't support GROUP BY grouping-sets nor GROUP BY super-groups(include ROLLUP) even on Version 9.
Reply With Quote
  #3 (permalink)  
Old 04-27-10, 13:49
WindInFace WindInFace is offline
Registered User
 
Join Date: Mar 2010
Posts: 7
Thank you tonkump!

I'll have create my own total row with a union.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On