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
 

 

SQL Query

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: SQL Query
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    Post subject: Reply to: SQL Query
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    Post subject:
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: 171
Location: Bangalore

PostPosted: Thu Apr 03, 2008 3:36 pm    Post subject: Reply to: SQL Query
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    Post subject: Reply to: SQL Query
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    Post subject:
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    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
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Omegamon for DB2 query ashek15 DB2 0 Wed Feb 15, 2017 11:25 am
No new posts Query on DB2 WLM stored procedures ashek15 DB2 8 Sun Feb 12, 2017 11:13 pm
No new posts GETMAIN/FREEMAIN query Suja.Sai CICS 9 Tue Jan 31, 2017 12:01 pm


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