View previous topic :: View next topic
|
Author |
Message |
sree reddy
New User
Joined: 20 Jul 2007 Posts: 27 Location: bangalore
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
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 |
|
|
|