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

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


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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
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
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 All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts count contained values of several col... DB2 5
No new posts To join 2 tables and to join 3rd tabl... DB2 8
No new posts Create a specific record/file based o... SYNCSORT 8
No new posts variable in library name within a PROC. JCL & VSAM 11
No new posts Extract ISPF table column headings CLIST & REXX 2
Search our Forums:


Back to Top