Delete Query

D

David

I have a simple query- dates on one table and Data (approx 20 columns) inc
dates on another.
I want to delete from the large table all data pertaining to the dates on
the smaller table.
I was looking to run a delete query to do this- can you help?
 
J

John Spencer

The SQL of the Delete query would look like

DELETE
FROM LargeTable
WHERE LargeTable.DateField in
(SELECT DateField FROM SmallTable)

IF you can only use the QBE (Design View - query grid) then
-- Open a new query
-- Select the Large Table
-- Select the DateField
-- TYPE in the criteria under the date field - something like:
IN (SELECT [Name of Date Field] FROM [Small table])

-- Select Query: Delete Query from the menu
-- Select View: Datasheet view from the menu to SEE which records will be
deleted
-- Select View: Design view to switch back
-- IF you are happy with the proposed deletions then Select Query: Run from
the menu

WARNING: Backup your data first. If this doesn't do what you expect the
only way to recover is to
--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 

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