IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Query help please


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
revdpoel

New User


Joined: 01 Nov 2006
Posts: 56

PostPosted: Thu Sep 02, 2010 7:45 pm
Reply with quote

I got two tables.

table 1 consists of three fields:
automaat-key (primary key)
automaat-status (0= active, 1 = inactive, 2 = blocked)
pin (filled with 0 or 1)
chip (filled with 0 or 1)

Table 2 consists of two fields:
day-key (primary-key)
automaat-key (primary-key)
tx-aantal

For each automaat-status i got to have (separately) the sum of pin and the sum of chip. A row in table 1 is only taken in consideration when there is a row in table 2 for that specific automaat-key where tx-aantal > 0

Since there are three possible statuses, I will get three rows as a result.

Thanks
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Thu Sep 02, 2010 9:55 pm
Reply with quote

Code:
select sum()
group by
where exists

are very basic SQL-elements
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts RC query -Time column CA Products 3
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Query on edit primary command CLIST & REXX 5
No new posts Query on edit primary command CLIST & REXX 1
No new posts Issue with EXEC CICS QUERY SECURITY c... CICS 6
Search our Forums:

Back to Top