Deleting records from table

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
 
R

Roger Carlson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top