Deleting records from table

  • Thread starter Thread starter Oded Kovach
  • Start date Start date
O

Oded Kovach

Hello there

I have table that i need to delete some of the records there

The criteria for deleting the records come from diffrent query, the other
query cannot be updated and the relate between them based on more then one
field.

How can i build delete query that will do what i need?

any help would be useful
 
As long as the query that determines which records need to be deleted
returns a SINGLE column of values, you can use that query as a subquery in
the WHERE clause using the IN statement. For instance. Suppose your
delete-criteria query looks like this:

SELECT SomeID FROM SomeTable WHERE SomeDate < #1/1/2004#
(notice please that there is only ONE field in the field list)

You can use this query as a subquery like this:
DELETE * FROM SomeOtherTable
WHERE SomeOtherID IN (SELECT SomeID FROM SomeTable WHERE SomeDate <
#1/1/2004#);

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
Back
Top