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
 

 

Delete a variable from Table 2 if it appers in Table 1

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
b4uthammi
Warnings : 2

New User


Joined: 21 Feb 2005
Posts: 14
Location: hyderabad

PostPosted: Tue Aug 08, 2006 10:37 am    Post subject: Delete a variable from Table 2 if it appers in Table 1
Reply with quote

hai,

i have 2 tables. table 1 have the column wch-code and table2 have wcr-code.
my reqiurement is wcr-code could not be deleted if it appears in the table1(wch-code) .how can i implement the above logic.

thanks in advance

WARNING: TITLE EDITED
Back to top
View user's profile Send private message

stly
Warnings : 1

New User


Joined: 25 Jul 2005
Posts: 93

PostPosted: Tue Aug 08, 2006 12:30 pm    Post subject: Re: db2
Reply with quote

DELETE FROM TABLE2 WHERE TABLE2.WCHCODE NOT IN(SELECT WCRCODE FROM TABLE2)
Back to top
View user's profile Send private message
parikshit123

Active User


Joined: 01 Jul 2005
Posts: 269
Location: India

PostPosted: Fri Aug 11, 2006 11:46 am    Post subject:
Reply with quote

Hi,

You can use "IF EXIST" clause in your SQL statement as well.
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 SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts JCL to delete component in a package sundaram.naveen Compuware & Other Tools 14 Tue Nov 29, 2016 6:21 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts Need Rexx Program to Load in to DB2 T... Hareesh Verma CLIST & REXX 22 Tue Sep 20, 2016 2:59 pm
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm


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