We help IT Professionals succeed at work.

Correct Access SQL Statement for Multiple Criteria Deletion

Medium Priority
464 Views
Last Modified: 2013-11-07
I would like to delete rows from an Access table, I will be creating criteria with SQL DELETE and WHERE statements, for two separate criteria, in two fields. I have attempted using a DELETE query as well,

For Example:
DELETE FROM table WHERE Field1="Instances" AND Field2 = "Findings";
 
Field1 criteria may be in rows 1 - 4, and Field2 criteria in rows 7 - 10. Assume that there are no rows in common that fulfill both criteria. In one SQL programming statement, I want to delete all of these 8 rows, and have not been able to thus far.

Thanks
Comment
Watch Question

Commented:
Change the AND to OR as follows -

DELETE FROM table WHERE Field1="Instances" OR Field2 = "Findings";



Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
CERTIFIED EXPERT
Top Expert 2010
Commented:
If this is run within Access, Jet may prefer this subtly different syntax:

DELETE * FROM table WHERE Field1="Instances" OR Field2 = "Findings";

No points for this, please :)
CERTIFIED EXPERT
Top Expert 2010

Commented:
tahirih,

I appreciate the points, but in fairness you should have given reb73 at least a split.

Regards,

Patrick

Author

Commented:
Please confirm howI can split the points. Thanks

Author

Commented:
I wanted to split the points. Thanks

Commented:
Thanks tahirih..  Patrick, you're a gentleman.. Cheers!
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.