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

Inner Join query


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

New User


Joined: 20 Jul 2007
Posts: 27
Location: bangalore

PostPosted: Tue Aug 18, 2009 10:59 pm
Reply with quote

I have 3 tables

1. a tabel(table 1)

a Cycle-event-id (Primary Key)
b cut-date
c cut-code

2. b table (table 2)

a pay id (primary key)
b cycle-event-id (foreigh key)
c b-code
d b-name
e b-phone-number
f b-comment
g b-status
h b-pharm-id

3. C table(table 3)

a root-id (primary key)
b pay id (foreigh key)
c cust-id
d g-num
e res
f text
g cust -aff

Select a. Cycle_event_id
B. pay_id
B. b_PHONE_NBR,
B. b_name,
B. b_note,
B. b_Code,
B. b_comment,
B. b-status
c. Cut_AFF,
c. CUST_ID,
c.PAYMENT_GRP_NBR,
c. RESP_PERCENT


from a

where

a .CUT_DT = :WS-HOLD-CUT-DATE
AND
a.CUT_Code = :WS-HOLD-cut-code

inner join b

on a.CYCle_EVENT_ID = B._CYC_EVENT_ID


Inner join C
on B. pay-id = c-pay-id
-----

The input to this query is WS-HOLD-CUT-DATE, WS-HOLD-cut-code

Can anyone suggest if this query is right , i cannot test this since the tables are not yet built

Thanks
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: Wed Aug 19, 2009 12:37 am
Reply with quote

Hello,

Quote:
i cannot test this since the tables are not yet built
If you'd like to test queries before the "real" environment is set up, you might consider:
www-01.ibm.com/software/data/db2/express/download.html

You could install this on a pc and do lots of things. . .
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Wed Aug 19, 2009 1:39 pm
Reply with quote

Quote:

from a

where

a .CUT_DT = :WS-HOLD-CUT-DATE
AND
a.CUT_Code = :WS-HOLD-cut-code

inner join b

on a.CYCle_EVENT_ID = B._CYC_EVENT_ID

Inner join C
on B. pay-id = c-pay-id



Rearranging a bit would help you ..

Code:

from a

inner join b

on a.CYCle_EVENT_ID = B._CYC_EVENT_ID


Inner join C
on B. pay-id = c-pay-id
where

a .CUT_DT = :WS-HOLD-CUT-DATE
AND
a.CUT_Code = :WS-HOLD-cut-code
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