Well, well, well!
It's Goethel Rob! Hehe. How have you been?
Try the following code.
DELETE FROM EMP2 E2
WHERE EMPNO =
(SELECT EMPNO
FROM EMP1 E1
WHERE E2.EMPNO = E1.EMPNO);
Please take a few minutes to provide feedback on the quality of service you received from our staff. The Department of Education values your feedback as a customer. Commissioner of Education Jeanine Blomberg is committed to continuously assessing and improving the level and quality of services provided to you.Simply use the link below. Thank you in advance for completing the survey.
http://data.fldoe.org/cs/default.cfm?staff=Ed.[Email address protected]
-----Original Message-----
From: Goethel Rob
[mailto:db2udbdba-ezmlmshield-x16040074.[Email address protected]
Sent: Tuesday, June 26, 2007 11:06 AM
To: LazyDBA Discussion
Subject: SQL delete question.
I know there's probably an easy answer to this one, but I can't think of
it today! Help!
How do you do a delete from a target table where the keys are in another
table.
Example:
Target table:
batch#, Seq#, data values
Keys to delete table:
batch#, Seq#
Batch# and Seq# are the key values and must be a concatenated key set.
I was thinking something like
Delete from target_table a
where a.batch# = (select batch# from keystodelete_table b where
a.batch#=b.batch# and a.seq#=b.seq#) and a.seq#=(select b.seq# from
keystodelete_table where a.batch#=b.batch# )
Thanks much.
Rob
************************************************************************
**************
This e-mail message and all attachments transmitted with it may contain
legally privileged and/or confidential information intended solely for
the use of the addressee(s). If the reader of this message is not the
intended recipient, you are hereby notified that any reading,
dissemination, distribution, copying, forwarding or other use of this
message or its attachments is strictly prohibited. If you have received
this message in error, please notify the sender immediately and delete
this message and all copies and backups thereof.
Thank you.
************************************************************************
**************
---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To post a dba job: http://jobs.lazydba.com
To Subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
DB2 & UDB email list listserv db2-l LazyDBA home page