Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Posts
    1,119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Delete query (2000)

    If I have 2 tables and I join the 2 tables by a field that is in both tables. I want to delete the records where the joined fields match. How would I set up a delete query to do this. The select query works but when I change it to a delete query it says it cannot delete records from tables.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Delete query (2000)

    Do you want to delete records from both tables where the joined field matches, or just from one of the tables?

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Posts
    1,119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete query (2000)

    Just one of the tables.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Delete query (2000)

    OK, let's say that you want to delete records from TableA that match records in TableB on a field JoinID.

    Create a query based on TableA alone. Add the JoinID field to the query grid. In the Criteria line for this field, enter the following (with the appropriate names substituted):

    In (SELECT [JoinID] FROM <!t>[TableB]<!/t>)

    Now, change the query into a Delete query and run it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •