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 Join in SQL Query vickey_dw DB2 2 Tue Jan 17, 2017 12:15 am
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


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