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

SQL Query


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

New User


Joined: 19 Feb 2007
Posts: 9
Location: India

PostPosted: Thu Apr 03, 2008 2:47 pm
Reply with quote

Could anyone please write a query for me ...

I need the Account numbers pressent in CC_CLNTCLNT_ACCT but not in CC_CLNT_ACCT tables, by validating these 3 cols present in both tables. ABA_BSB_STAT_I
ABA_BSB_BRCH_I
CC_ACCT_N

The account numbers is the combination of above 3 cols.
Back to top
View user's profile Send private message
zero

New User


Joined: 01 Dec 2007
Posts: 21
Location: Hyderabad

PostPosted: Thu Apr 03, 2008 2:59 pm
Reply with quote

Can you give an example ?
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Thu Apr 03, 2008 3:35 pm
Reply with quote

select ABA_BSB_STAT_I||ABA_BSB_BRCH_I||CC_ACCT_N as account
from CC_CLNTCLNT_ACCT A where not exists
(select * from CC_CLNT_ACCT b where a.ABA_BSB_STAT_I = b.ABA_BSB_STAT_I
and a.ABA_BSB_BRCH_I = b.ABA_BSB_BRCH_I and a.CC_ACCT_N = b.CC_ACCT_N)
Back to top
View user's profile Send private message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 174
Location: Bangalore

PostPosted: Thu Apr 03, 2008 3:36 pm
Reply with quote

Here is the query for you,

Code:
SELECT ACCOUNT_NUM FROM
                     CC_CLNTCLNT_ACCT A,
                      CC_CLNT_ACCT B
WHERE A.ABA_BSB_STAT_I = B.ABA_BSB_STAT_I
AND A.ABA_BSB_BRCH_I =B.ABA_BSB_BRCH_I
AND A.CC_ACCT_N = B.CC_ACCT_N


I think I have given you the right query..
If not can you please provide example...
Back to top
View user's profile Send private message
zero

New User


Joined: 01 Dec 2007
Posts: 21
Location: Hyderabad

PostPosted: Thu Apr 03, 2008 4:01 pm
Reply with quote

Can you give an example ?
Back to top
View user's profile Send private message
Richa Jain

New User


Joined: 18 Mar 2008
Posts: 35
Location: Gurgaon

PostPosted: Fri Apr 04, 2008 12:38 pm
Reply with quote

Quote:
The account numbers is the combination of above 3 cols.


Is the Acct No = ABA_BSB_STAT_I + ABA_BSB_BRCH_I + CC_ACCT_N ?

eg: ABA_BSB_STAT_I = 1234
ABA_BSB_BRCH_I = 567
CC_ACCT_N = 890

Acct No = 123456789

Try this.

Code:

SELECT ACCOUNT_NUM FROM
                     CC_CLNTCLNT_ACCT A,
                      CC_CLNT_ACCT B
WHERE A.ABA_BSB_STAT_I <> B.ABA_BSB_STAT_I
AND A.ABA_BSB_BRCH_I <> B.ABA_BSB_BRCH_I
AND A.CC_ACCT_N <> B.CC_ACCT_N
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