AND and OR in Access queries
As soon as a query has more than one condition, the grid row decides how Access combines them. Once that clicks, you build tricky filters without writing SQL.
In short: criteria in the same row apply together (AND). Every further row (or, and the rows below it) is an alternative (OR). Several values for one field also fit in one cell: "Boston" Or "Austin", or In("Boston","Austin").
Before you start: Query criteria.
Try it now
Two conditions, both must be true: from the UK and a regular customer.
Task Show Company, LastName and City of all regular customers from the UK.
Customers 25 rows, 10 columns
| CustomerID | Company | FirstName | LastName | City | PostalCode | Country | CustomerSince | Regular | Discount |
|---|---|---|---|---|---|---|---|---|---|
| 1 | Noah | Evans | Leeds | LS1 1UR | UK | 28 Feb 2023 | ☑ | 0.1 | |
| 2 | Shaw & Partners | Noah | Davies | Glasgow | G1 1XQ | UK | 5 Feb 2024 | ☐ | 0.03 |
| 3 | Northlight Inc | Sophia | Hall | Denver | 80202 | USA | 30 Jun 2024 | ☑ | 0 |
| 4 | Olivia | Evans | Bristol | BS1 4DJ | UK | 29 Jun 2022 | ☑ | 0 | |
| 5 | Olivia | Smith | London | EC1A 1BB | UK | 23 Sep 2025 | ☑ | 0 | |
| 6 | Northlight Inc | Mia | Evans | Manchester | M1 1AE | UK | 1 Feb 2025 | ☐ | 0.1 |
| 7 | Bauer Ltd | Ava | Wilson | UK | 14 Oct 2024 | ☐ | 0.05 | ||
| 8 | Lucas | Taylor | Glasgow | G1 1XQ | UK | 2 Jul 2023 | ☐ | 0 | |
| 9 | Jack | Clark | Seattle | 98101 | USA | 7 Nov 2022 | ☐ | 0.1 | |
| 10 | Northlight Inc | Henry | Taylor | Denver | 80202 | USA | 3 Nov 2022 | ☑ | 0.1 |
| 11 | Northlight Inc | Oliver | Johnson | Bristol | BS1 4DJ | UK | 6 Mar 2024 | ☐ | 0 |
| 12 | Henry | Taylor | Chicago | 60601 | USA | 24 Dec 2023 | ☐ | 0 | |
| 13 | Northlight Inc | Noah | Taylor | London | EC1A 1BB | UK | 12 Oct 2022 | ☐ | 0 |
| 14 | Summit Consulting | Mia | Smith | Austin | 78701 | USA | 6 Feb 2022 | ☑ | 0 |
| 15 | Mia | Clark | Austin | 78701 | USA | 9 Mar 2022 | ☑ | 0.05 | |
| 16 | Chloe | Hall | Seattle | 98101 | USA | 4 May 2022 | ☐ | 0.03 | |
| 17 | Market Street Clinic | Sophia | Johnson | Boston | 02108 | USA | 4 Jun 2023 | ☑ | 0 |
| 18 | Roth Legal | Mia | Wright | Manchester | M1 1AE | UK | 23 Sep 2022 | ☑ | 0.05 |
| 19 | Northlight Inc | Grace | Wright | UK | 16 Dec 2023 | ☐ | 0.03 | ||
| 20 | Northlight Inc | Olivia | Brown | Boston | 02108 | USA | 19 Jun 2023 | ☐ | 0.03 |
| 21 | Liam | Brown | Boston | 02108 | USA | 23 Jun 2025 | ☐ | 0.03 | |
| 22 | Bauer Ltd | James | Johnson | Manchester | M1 1AE | UK | 5 Jun 2025 | ☐ | 0.05 |
| 23 | Noah | Wilson | Austin | 78701 | USA | 23 May 2022 | ☐ | 0 | |
| 24 | Market Street Clinic | James | Smith | Bristol | BS1 4DJ | UK | 16 Jan 2022 | ☐ | 0.1 |
| 25 | Northlight Inc | Sophia | Hall | Denver | 80202 | USA | 4 Aug 2025 | ☑ | 0 |
The rule
| In the grid | means | SQL view |
|---|---|---|
| two criteria in the same row | both must be met | … AND … |
| criteria in different rows | one row is enough | (…) OR (…) |
"A" Or "B" in one cell | field is A or B | Field="A" Or Field="B" |
In("A","B") | field is one of the values | Field In ("A","B") |
Each criteria row is a complete condition of its own. A field left empty in a row plays no part in that row.
OR for one field
For several values of the same field you have three equal ways: two rows, Or in one cell, or In. With many values, In is the shortest.
Task Show LastName, City and Country of all customers in Boston or Austin, sorted by city.
Customers 25 rows, 10 columns
| CustomerID | Company | FirstName | LastName | City | PostalCode | Country | CustomerSince | Regular | Discount |
|---|---|---|---|---|---|---|---|---|---|
| 1 | Noah | Evans | Leeds | LS1 1UR | UK | 28 Feb 2023 | ☑ | 0.1 | |
| 2 | Shaw & Partners | Noah | Davies | Glasgow | G1 1XQ | UK | 5 Feb 2024 | ☐ | 0.03 |
| 3 | Northlight Inc | Sophia | Hall | Denver | 80202 | USA | 30 Jun 2024 | ☑ | 0 |
| 4 | Olivia | Evans | Bristol | BS1 4DJ | UK | 29 Jun 2022 | ☑ | 0 | |
| 5 | Olivia | Smith | London | EC1A 1BB | UK | 23 Sep 2025 | ☑ | 0 | |
| 6 | Northlight Inc | Mia | Evans | Manchester | M1 1AE | UK | 1 Feb 2025 | ☐ | 0.1 |
| 7 | Bauer Ltd | Ava | Wilson | UK | 14 Oct 2024 | ☐ | 0.05 | ||
| 8 | Lucas | Taylor | Glasgow | G1 1XQ | UK | 2 Jul 2023 | ☐ | 0 | |
| 9 | Jack | Clark | Seattle | 98101 | USA | 7 Nov 2022 | ☐ | 0.1 | |
| 10 | Northlight Inc | Henry | Taylor | Denver | 80202 | USA | 3 Nov 2022 | ☑ | 0.1 |
| 11 | Northlight Inc | Oliver | Johnson | Bristol | BS1 4DJ | UK | 6 Mar 2024 | ☐ | 0 |
| 12 | Henry | Taylor | Chicago | 60601 | USA | 24 Dec 2023 | ☐ | 0 | |
| 13 | Northlight Inc | Noah | Taylor | London | EC1A 1BB | UK | 12 Oct 2022 | ☐ | 0 |
| 14 | Summit Consulting | Mia | Smith | Austin | 78701 | USA | 6 Feb 2022 | ☑ | 0 |
| 15 | Mia | Clark | Austin | 78701 | USA | 9 Mar 2022 | ☑ | 0.05 | |
| 16 | Chloe | Hall | Seattle | 98101 | USA | 4 May 2022 | ☐ | 0.03 | |
| 17 | Market Street Clinic | Sophia | Johnson | Boston | 02108 | USA | 4 Jun 2023 | ☑ | 0 |
| 18 | Roth Legal | Mia | Wright | Manchester | M1 1AE | UK | 23 Sep 2022 | ☑ | 0.05 |
| 19 | Northlight Inc | Grace | Wright | UK | 16 Dec 2023 | ☐ | 0.03 | ||
| 20 | Northlight Inc | Olivia | Brown | Boston | 02108 | USA | 19 Jun 2023 | ☐ | 0.03 |
| 21 | Liam | Brown | Boston | 02108 | USA | 23 Jun 2025 | ☐ | 0.03 | |
| 22 | Bauer Ltd | James | Johnson | Manchester | M1 1AE | UK | 5 Jun 2025 | ☐ | 0.05 |
| 23 | Noah | Wilson | Austin | 78701 | USA | 23 May 2022 | ☐ | 0 | |
| 24 | Market Street Clinic | James | Smith | Bristol | BS1 4DJ | UK | 16 Jan 2022 | ☐ | 0.1 |
| 25 | Northlight Inc | Sophia | Hall | Denver | 80202 | USA | 4 Aug 2025 | ☑ | 0 |
This exercise is part of Premium.
Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.
See Premium Already Premium? Log in
The first exercise in this lesson is free.
AND and OR mixed
What belongs together goes in the same row. That way one query shows two quite different groups: invoices without freight and PayPal orders with high freight.
Task Show OrderID, PaymentMethod and Freight of all invoice orders with no freight (0), plus all PayPal orders with freight above 5.
Orders 120 rows, 6 columns
| OrderID | CustomerID | OrderDate | ShippedDate | Freight | PaymentMethod |
|---|---|---|---|---|---|
| 1 | 16 | 30 Apr 2025 | 3 May 2025 | 4.90 | Invoice |
| 2 | 23 | 18 May 2025 | 26 May 2025 | 4.90 | PayPal |
| 3 | 19 | 16 Jul 2026 | 4.90 | Direct debit | |
| 4 | 11 | 31 Mar 2025 | 1 Apr 2025 | 0.00 | Invoice |
| 5 | 6 | 7 Dec 2025 | 9 Dec 2025 | 9.90 | PayPal |
| 6 | 18 | 19 May 2026 | 26 May 2026 | 6.90 | Direct debit |
| 7 | 7 | 15 Jun 2026 | 16 Jun 2026 | 4.90 | Credit card |
| 8 | 20 | 18 Mar 2025 | 19 Mar 2025 | 0.00 | PayPal |
| 9 | 10 | 29 Oct 2025 | 3 Nov 2025 | 0.00 | Direct debit |
| 10 | 7 | 21 Nov 2026 | 4.90 | Invoice | |
| 11 | 1 | 2 May 2025 | 10 May 2025 | 9.90 | Direct debit |
| 12 | 10 | 7 Aug 2025 | 9 Aug 2025 | 0.00 | Invoice |
| 13 | 3 | 17 Sep 2026 | 24 Sep 2026 | 9.90 | PayPal |
| 14 | 16 | 29 Jan 2026 | 1 Feb 2026 | 6.90 | Invoice |
| 15 | 4 | 13 Jun 2025 | 21 Jun 2025 | 4.90 | PayPal |
| 16 | 12 | 3 Nov 2025 | 12 Nov 2025 | 4.90 | Invoice |
| 17 | 9 | 5 May 2026 | 8 May 2026 | 9.90 | PayPal |
| 18 | 9 | 26 Sep 2025 | 2 Oct 2025 | 4.90 | PayPal |
| 19 | 14 | 8 Mar 2026 | 10 Mar 2026 | 0.00 | Credit card |
| 20 | 1 | 2 Apr 2026 | 6.90 | PayPal | |
| 21 | 18 | 17 Nov 2026 | 4.90 | PayPal | |
| 22 | 11 | 27 Jul 2026 | 4 Aug 2026 | 4.90 | PayPal |
| 23 | 12 | 23 Jun 2026 | 28 Jun 2026 | 4.90 | Credit card |
| 24 | 10 | 12 Jan 2026 | 16 Jan 2026 | 0.00 | Direct debit |
| 25 | 1 | 30 Mar 2026 | 31 Mar 2026 | 4.90 | Credit card |
| 26 | 3 | 3 Mar 2025 | 7 Mar 2025 | 4.90 | Invoice |
| 27 | 24 | 9 Mar 2025 | 11 Mar 2025 | 4.90 | PayPal |
| 28 | 1 | 22 Sep 2025 | 28 Sep 2025 | 4.90 | PayPal |
| 29 | 1 | 18 Feb 2025 | 22 Feb 2025 | 4.90 | Invoice |
| 30 | 19 | 13 Oct 2025 | 18 Oct 2025 | 4.90 | PayPal |
| 31 | 10 | 19 Sep 2025 | 25 Sep 2025 | 6.90 | PayPal |
| 32 | 6 | 19 Jun 2026 | 24 Jun 2026 | 4.90 | Credit card |
| 33 | 20 | 16 Jun 2026 | 22 Jun 2026 | 9.90 | Credit card |
| 34 | 13 | 23 May 2026 | 27 May 2026 | 9.90 | Direct debit |
| 35 | 16 | 24 May 2026 | 2 Jun 2026 | 4.90 | PayPal |
| 36 | 14 | 9 Nov 2026 | 14 Nov 2026 | 4.90 | PayPal |
| 37 | 3 | 11 Mar 2026 | 18 Mar 2026 | 9.90 | PayPal |
| 38 | 22 | 2 Jan 2025 | 10 Jan 2025 | 0.00 | Invoice |
| 39 | 12 | 21 Oct 2025 | 27 Oct 2025 | 0.00 | Invoice |
| 40 | 20 | 4 Nov 2026 | 5 Nov 2026 | 9.90 | PayPal |
| 41 | 17 | 29 Mar 2026 | 30 Mar 2026 | 4.90 | PayPal |
| 42 | 13 | 6 Jan 2026 | 8 Jan 2026 | 0.00 | Invoice |
| 43 | 3 | 24 Feb 2026 | 26 Feb 2026 | 4.90 | PayPal |
| 44 | 7 | 21 Sep 2026 | 28 Sep 2026 | 4.90 | Invoice |
| 45 | 2 | 17 Apr 2025 | 23 Apr 2025 | 0.00 | Direct debit |
| 46 | 7 | 27 Apr 2026 | 28 Apr 2026 | 4.90 | Invoice |
| 47 | 3 | 16 Nov 2026 | 6.90 | Direct debit | |
| 48 | 1 | 26 Jun 2026 | 27 Jun 2026 | 4.90 | Credit card |
| 49 | 24 | 29 Apr 2026 | 30 Apr 2026 | 4.90 | PayPal |
| 50 | 1 | 23 Mar 2025 | 28 Mar 2025 | 4.90 | Direct debit |
| 51 | 10 | 28 Jan 2026 | 31 Jan 2026 | 0.00 | PayPal |
| 52 | 22 | 9 May 2026 | 15 May 2026 | 4.90 | Direct debit |
| 53 | 10 | 29 Dec 2025 | 7 Jan 2026 | 0.00 | Credit card |
| 54 | 4 | 17 Oct 2026 | 18 Oct 2026 | 9.90 | Credit card |
| 55 | 24 | 30 Aug 2025 | 31 Aug 2025 | 6.90 | Credit card |
| 56 | 6 | 29 Jan 2026 | 2 Feb 2026 | 4.90 | PayPal |
| 57 | 18 | 10 Dec 2025 | 13 Dec 2025 | 6.90 | Direct debit |
| 58 | 13 | 4 Mar 2025 | 9 Mar 2025 | 9.90 | Invoice |
| 59 | 11 | 29 Nov 2025 | 7 Dec 2025 | 6.90 | Invoice |
| 60 | 9 | 30 Oct 2025 | 4 Nov 2025 | 4.90 | Invoice |
| 61 | 10 | 17 Mar 2026 | 19 Mar 2026 | 4.90 | PayPal |
| 62 | 9 | 14 Jul 2025 | 21 Jul 2025 | 4.90 | PayPal |
| 63 | 8 | 24 May 2025 | 2 Jun 2025 | 0.00 | Invoice |
| 64 | 4 | 29 Sep 2026 | 5 Oct 2026 | 4.90 | Invoice |
| 65 | 10 | 22 Jan 2026 | 27 Jan 2026 | 9.90 | Invoice |
| 66 | 9 | 27 Mar 2026 | 28 Mar 2026 | 9.90 | Credit card |
| 67 | 14 | 11 Sep 2026 | 18 Sep 2026 | 4.90 | PayPal |
| 68 | 4 | 9 Jun 2026 | 16 Jun 2026 | 0.00 | Invoice |
| 69 | 17 | 10 Jan 2026 | 17 Jan 2026 | 9.90 | Credit card |
| 70 | 21 | 1 Apr 2026 | 2 Apr 2026 | 4.90 | Credit card |
| 71 | 15 | 19 Mar 2025 | 21 Mar 2025 | 4.90 | Credit card |
| 72 | 20 | 4 Mar 2025 | 6 Mar 2025 | 4.90 | Invoice |
| 73 | 10 | 24 May 2025 | 9.90 | PayPal | |
| 74 | 8 | 3 Jan 2025 | 4 Jan 2025 | 9.90 | Invoice |
| 75 | 23 | 30 Oct 2025 | 6 Nov 2025 | 9.90 | Direct debit |
| 76 | 22 | 30 Aug 2025 | 3 Sep 2025 | 6.90 | Invoice |
| 77 | 2 | 18 Nov 2025 | 23 Nov 2025 | 6.90 | PayPal |
| 78 | 3 | 22 Dec 2025 | 26 Dec 2025 | 4.90 | Invoice |
| 79 | 21 | 26 May 2026 | 6.90 | Invoice | |
| 80 | 24 | 23 Feb 2026 | 27 Feb 2026 | 4.90 | Direct debit |
| 81 | 2 | 5 Jun 2026 | 6.90 | PayPal | |
| 82 | 11 | 14 Aug 2026 | 6.90 | Invoice | |
| 83 | 21 | 10 May 2026 | 18 May 2026 | 9.90 | Credit card |
| 84 | 13 | 12 Feb 2025 | 19 Feb 2025 | 4.90 | Credit card |
| 85 | 2 | 22 Jan 2026 | 30 Jan 2026 | 4.90 | PayPal |
| 86 | 2 | 31 Oct 2025 | 4 Nov 2025 | 9.90 | Credit card |
| 87 | 6 | 9 Mar 2025 | 17 Mar 2025 | 9.90 | Credit card |
| 88 | 3 | 5 Feb 2025 | 14 Feb 2025 | 9.90 | Direct debit |
| 89 | 17 | 26 Jan 2025 | 29 Jan 2025 | 6.90 | PayPal |
| 90 | 11 | 25 Sep 2026 | 4.90 | Direct debit | |
| 91 | 22 | 23 May 2025 | 1 Jun 2025 | 4.90 | Credit card |
| 92 | 20 | 29 Jan 2025 | 2 Feb 2025 | 0.00 | PayPal |
| 93 | 8 | 16 Jul 2026 | 18 Jul 2026 | 6.90 | Invoice |
| 94 | 2 | 7 Aug 2025 | 10 Aug 2025 | 0.00 | Invoice |
| 95 | 22 | 6 Jan 2025 | 8 Jan 2025 | 6.90 | Credit card |
| 96 | 15 | 15 Dec 2025 | 24 Dec 2025 | 4.90 | Invoice |
| 97 | 6 | 23 Sep 2025 | 30 Sep 2025 | 6.90 | Invoice |
| 98 | 10 | 10 Sep 2025 | 16 Sep 2025 | 0.00 | Invoice |
| 99 | 14 | 10 Jan 2026 | 13 Jan 2026 | 9.90 | Credit card |
| 100 | 16 | 20 Nov 2025 | 24 Nov 2025 | 0.00 | Credit card |
| 101 | 18 | 26 Jul 2026 | 27 Jul 2026 | 4.90 | Credit card |
| 102 | 2 | 15 May 2025 | 9.90 | Invoice | |
| 103 | 4 | 8 Feb 2025 | 15 Feb 2025 | 6.90 | Credit card |
| 104 | 7 | 16 Sep 2026 | 17 Sep 2026 | 4.90 | Invoice |
| 105 | 7 | 26 Jan 2025 | 31 Jan 2025 | 4.90 | Direct debit |
| 106 | 23 | 2 Aug 2026 | 3 Aug 2026 | 6.90 | Direct debit |
| 107 | 13 | 22 Jan 2026 | 26 Jan 2026 | 9.90 | Credit card |
| 108 | 4 | 6 Oct 2025 | 14 Oct 2025 | 4.90 | Direct debit |
| 109 | 10 | 6 Nov 2025 | 9 Nov 2025 | 4.90 | Direct debit |
| 110 | 9 | 17 Oct 2026 | 18 Oct 2026 | 9.90 | PayPal |
| 111 | 23 | 24 May 2026 | 25 May 2026 | 6.90 | Direct debit |
| 112 | 2 | 31 Aug 2025 | 1 Sep 2025 | 9.90 | Direct debit |
| 113 | 20 | 25 Jul 2026 | 28 Jul 2026 | 0.00 | Direct debit |
| 114 | 6 | 24 Nov 2025 | 27 Nov 2025 | 9.90 | Credit card |
| 115 | 8 | 27 Nov 2025 | 30 Nov 2025 | 6.90 | Credit card |
| 116 | 1 | 18 Mar 2025 | 25 Mar 2025 | 0.00 | Direct debit |
| 117 | 9 | 16 Mar 2025 | 19 Mar 2025 | 6.90 | Credit card |
| 118 | 4 | 10 Jul 2026 | 15 Jul 2026 | 0.00 | Invoice |
| 119 | 14 | 23 Jun 2025 | 28 Jun 2025 | 4.90 | Direct debit |
| 120 | 2 | 21 Sep 2026 | 27 Sep 2026 | 4.90 | Direct debit |
This exercise is part of Premium.
Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.
See Premium Already Premium? Log in
The first exercise in this lesson is free.
In real Access
- Open the query in Design view.
- Put criteria that apply together in the same Criteria row.
- Put alternatives in the or row below; for more alternatives just use the next empty rows.
- To check, use View, SQL View: there you see the brackets Access makes from the rows.
Common mistakes
And instead of Or for one field
"Boston" And "Austin" asks for a city that is both at once. No record matches, the result is empty.
A condition in only one row
If a condition should apply to all alternatives (say “only 2026”), it has to be in every criteria row. If it is only in the first row, the second row ignores it.
FAQ
How many or rows are there?
More empty rows follow below the or row. If you need many, one cell with In is clearer.
How do I write “everything except”?
With <>"UK" or Not In("UK","USA").