Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Delete query (Access 2000)

    I need to update the table products from the products in the table [order details] and also delete all the products in the table products that are not contained in the table [order details]. My update query is sucessful as follows
    UPDATE products1 INNER JOIN [Order Details1] ON products1.Productid = [Order Details1].productid SET products1.branch9 = [order details1].[cartons];
    But how can i delete the products that are not contained in the table order details?

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

    Re: Delete query (Access 2000)

    You can use the Find Unmatched Query Wizard to create a query that finds all products that don't have a matching record in the order details table.
    Or you can write the SQL yourself:

    DELETE ProductID FROM Products1 WHERE ProductID Not In (SELECT ProductID FROM [Order Details1])

  3. #3
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete query (Access 2000)

    Thank you so much! I hurry to let you know that the query runs awsome now !

Posting Permissions

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