DB2 Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDB2 Development

Closed Thread
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old March 28th, 2008, 10:51 AM
rogerTHAT rogerTHAT is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2008
Location: New Braunfels, TX
Posts: 2 rogerTHAT User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 m 5 sec
Reputation Power: 0
To GROUP, or not to GROUP...

Hi, I'm developing a SQL statement (that will be called by a RUNSQLSTM in a CL program) that joins 6 tables. I use nested table expressions and a few subqueries. It's pretty ambitious for someone who has not done much SQL coding.

The main problem is that the "left-most" table uses Group By, but I have to specify a couple of column names in that table that have no grouping functions - they are detail-level columns. I just need to specify them so I can join them later to other tables. I can get the query to run by including the detail-level columns in my Group By statement but then, of course, I do not get the grouping level that I need.

Am I trying to do too much in one statement, or is there a way to join at a detail record level to get data from other tables and still retain output at a group level?

Reply With Quote
  #2  
Old March 28th, 2008, 03:27 PM
rogerTHAT rogerTHAT is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2008
Location: New Braunfels, TX
Posts: 2 rogerTHAT User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 m 5 sec
Reputation Power: 0
"Not to group" is the answer

I decided to remove the grouping functions, output all the detail to one file, and then run a second SQL statement to do the grouping. It works fine. This issue - as short-lived as it was - is resolved.

Reply With Quote
Closed Thread

Viewing: Dev Shed ForumsDatabasesDB2 Development > To GROUP, or not to GROUP...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway