Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 how do i delete or update using 2 tables

Author  Topic 

csphard
Posting Yak Master

113 Posts

Posted - 2003-07-15 : 18:15:40
My goal is to delete information from one table based on a comparison
of 2 tables.
first i thought i would delete some information using a where clause that compared to tables. Then i realize it did not know where to delete from


delete from
due_evals d,
emp_information_test e
where d.datetobefiled between '01/01/2003' and '02/28/2003'
and d_evals.empid = e.empid
and e.bureau in ('375')
and d.payloc_comp_date is null
and d.eval_type = 'Probation'



second i thought i would update a field in the table with the word delete where the criteria matches. Then delete using a where clause searching for the word delete in that field

update due_evals set hr_updated_by = 'delete'
where due_evals.datetobefiled between '01/01/2003' and '02/28/2003'
and due_evals.empid = emp_information_test.empid
and emp_information_test.bureau in ('375')
and due_evals.payloc_comp_date is null
and due_evals.eval_type = 'Probation'





chadmat
The Chadinator

1974 Posts

Posted - 2003-07-15 : 18:32:28
Duplicate post. See: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=27763

http://www.clrsoft.com

Software built for the Common Language Runtime.
Go to Top of Page
   

- Advertisement -