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

Help with join query


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

New User


Joined: 26 Jun 2009
Posts: 2
Location: US

PostPosted: Fri Jun 26, 2009 10:16 pm
Reply with quote

Hi,

I have three tables:

Code:

Table1:
Tran id   Tran date       Tran amt   Sch code
01          01/20/2009    150K         S1
02          01/20/2009    203K         S2

Table2:
Sch code  effective date  Sub sch code
S1           01/01/2009      SS1
S2           01/01/2009      SS2

Table3:
Sub sch code    Amt upper limit    pts
SS1                        99999   10
SS1                      999999   20
SS1                     9999999   30


Basically this table should be:
Table3:
Sub sch code    Amt lower limit     Amt upper limit    pts
SS1                      0                         99999          10
SS1                      100K                  999999          20
SS1                     200K                  9999999          30

but it stores only the upper limit.
 


Now the requirement is that for each transaction we have to find the pts from table3 based on the sch code and tran amt. To get the pts tran Tran amt should fall between the lower limit and upper limit amt defined in Table3.

Can you please help with this?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Jun 28, 2009 11:34 am
Reply with quote

Hello,

Your example data does not appear to be consistent.

Suggest you re-post the sample table data with a bit more variety in the data. You will also want to provide the processing "Rules" of how the data should be operated on.

When posting the inputs you have and the output you want, use the "Coide" rag (as you have done) but also use the Preview to make sure the post appears to the forum as you want it.
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 Join multiple records using splice DFSORT/ICETOOL 5
Search our Forums:

Back to Top