Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Help with join query

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Help with join query
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

Site Director


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

PostPosted: Sun Jun 28, 2009 11:34 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. MQ setup query mohitsaini Java & MQSeries 4 Sun Jan 08, 2017 1:53 am
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts Two Selects in a single select query Rohit Umarjikar DB2 1 Fri Nov 04, 2016 8:46 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us