Home » RDBMS Server » Server Administration » DELETE Records Based on multiple fields in another table
DELETE Records Based on multiple fields in another table [message #374209] Wed, 30 May 2001 11:05 Go to next message
scott
Messages: 73
Registered: September 1999
Member
Table1 contains the fields 'user_id' and 'sample_date'.
Table2 contains the fields 'user_id', 'sample_date', and 'status'.
I want to delete the records in Table1 where 'user_id' and 'sample_date' match the 'user_id' and 'sample_date' of records in Table2 with a certain 'status'.
Can someone help me out with the syntax for this.
Thanks,
Re: DELETE Records Based on multiple fields in another table [message #374210 is a reply to message #374209] Wed, 30 May 2001 11:12 Go to previous message
Andrew again...
Messages: 270
Registered: July 2000
Senior Member
something like this should work:

delete table_1
where (user_id, sample_date) in (
select user_id, sample_date
from table_2
where status = 'MY_VALUE')
Previous Topic: Re: select record for last column value
Next Topic: CHECK constraint question
Goto Forum:
  


Current Time: Wed Jul 03 18:09:24 CDT 2024