• Outlook User
  • New Outlook app
  • Outlook.com
  • Outlook Mac
  • Outlook & iCloud
  • Developer
  • Microsoft 365 Admin
    • Common Problems
    • Microsoft 365
    • Outlook BCM
    • Utilities & Addins

Create views using SQL/DAVX filters

Slipstick Systems

› Outlook › Rules, Filters & Views › Create views using SQL/DAVX filters

Last reviewed on August 14, 2018     7 Comments

One of Outlook's little known gems is the SQL filter in the Views Filter dialog. Although it looks confusing and technical, it's surprisingly easy to use. In many cases, you can let Outlook create a query for you by creating your criteria on the other tabs then enable SQL filtering and edit the query as needed. While you can create power filters if you know some SQL syntax, you don't need to know a lot about SQL to create filters not possible using the other filter tabs.

If you use the filter dialog often, you've already discovered the filters use the AND operator to string different criteria together. For example, you can create filters to view messages "From Amy AND Received in the last 7 days ", but not filters for messages "From Amy OR Received in the last 7 days". The filter dialog doesn't support the NOT operator directly, although you can use the Advanced filter to create some NOT filters indirectly. Using the SQL filter, you can easily create OR and NOT filters.

When you create the filter "From Amy AND Received in the last 7 days", the SQL looks like this:

("urn:schemas:httpmail:fromname" LIKE '%Amy%' AND %last7days("urn:schemas:httpmail:datereceived")%)

Switch to the SQL tab and change the AND to OR, so the rule shows all e-mail from Amy OR all e-mail that was received in the last 7 days.

("urn:schemas:httpmail:fromname" LIKE '%Amy%' OR %last7days("urn:schemas:httpmail:datereceived")%)

You can also use the NOT operator to restrict views. This filter shows all messages not from Amy that were received before yesterday.

NOT ("urn:schemas:httpmail:fromname" LIKE '%Amy%' OR NOT "urn:schemas:httpmail:datereceived" <= 'yesterday')

More Information

See Using Query Builder another option to use AND / OR operators in the filter dialog.

Create views using SQL/DAVX filters was last modified: August 14th, 2018 by Diane Poremsky
Post Views: 67

Related Posts:

  • How to configure Outlook to sync only recent messages when you have a
    Using a Large Exchange Mailbox on a Small Drive
  • Using Query Builder
  • Calendar list view
    Create a view for appointments that don't have reminders
  • Using Search Folders

About Diane Poremsky

A Microsoft Outlook Most Valuable Professional (MVP) since 1999, Diane is the author of several books, including Outlook 2013 Absolute Beginners Book. She also created video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.

Comments

  1. Matt says

    September 12, 2025 at 8:24 am

    Can you get this view to appear on the Search Folders display?

    Reply
    • Diane Poremsky says

      September 12, 2025 at 12:29 pm

      Search folders don't have a SQL tab so it can't be used in the search... but it does work in the view for a search folder.

      If you want to use SQL to create the search criteria, you can use VBA and redemption. (I need to write that up.)

      Reply
  2. James says

    August 12, 2024 at 10:36 am

    Would be helpful to know how to get the SQL tab to display if it's not there. I had it before, on another work laptop, and I remember having to configure that. Now, I have to find it again, and no one seems to be saying how to get it there but assuming it is there. Still looking...

    Reply
    • Diane Poremsky says

      August 12, 2024 at 10:55 am

      The SQL tab is there if it is supported but not all filter dialogs support it. You should have it on Views but not with conditional formatting.

      Reply
  3. Daniel says

    August 13, 2018 at 5:44 pm

    Am I right in understanding there's just no way to get this to show on the Advanced Find dialogue?

    Reply
    • Diane Poremsky says

      August 13, 2018 at 11:56 pm

      Correct. It's not available on all filter dialogs and there is not a registry key to add it. You can add the query builder, which gives control over AMD/OR operations.
      https://www.slipstick.com/outlook/using-query-builder/

      Reply
      • Daniel says

        August 15, 2018 at 12:34 am

        Thanks for confirming DIane. I've added the QB already.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Visit Slipstick Forums.
What's New at Slipstick.com

Latest EMO: Vol. 31 Issue 7

Subscribe to Exchange Messaging Outlook






Support Services

Do you need help setting up Outlook, moving your email to a new computer, migrating or configuring Office 365, or just need some one-on-one assistance?

Our Sponsors

CompanionLink
ReliefJet
  • Popular
  • Latest
  • Week Month All
  • Use Classic Outlook, not New Outlook
  • How to Remove the Primary Account from Outlook
  • Reset the New Outlook Profile
  • Disable "Always ask before opening" Dialog
  • This operation has been cancelled due to restrictions
  • How to Hide or Delete Outlook's Default Folders
  • Change Outlook's Programmatic Access Options
  • Use Public Folders In new Outlook
  • Removing Suggested Accounts in New Outlook
  • How to Delete Stuck Read Receipts
  • Sync Issues and Errors with Gmail and Yahoo accounts
  • Error Opening iCloud Appointments in Classic Outlook
  • Opt out of Microsoft 365 Companion Apps
  • Mail Templates in Outlook for Windows (and Web)
  • Urban legend: Microsoft Deletes Old Outlook.com Messages
  • Buttons in the New Message Notifications
  • Move Deleted Items to Another Folder Automatically
  • Open Outlook Templates using PowerShell
  • Count and List Folders in Classic Outlook
  • Google Workspace and Outlook with POP Mail
Ajax spinner

Recent Bugs List

Microsoft keeps a running list of issues affecting recently released updates at Fixes or workarounds for recent issues in classic Outlook (Windows).

For new Outlook for Windows: Fixes or workarounds for recent issues in new Outlook for Windows .

Outlook for Mac Recent issues: Fixes or workarounds for recent issues in Outlook for Mac

Outlook.com Recent issues: Fixes or workarounds for recent issues on Outlook.com

Office Update History

Update history for supported Office versions is at Update history for Office

Outlook Suggestions and Feedback

Outlook Feedback covers Outlook as an email client, including Outlook Android, iOS, Mac, and Windows clients, as well as the browser extension (PWA) and Outlook on the web.

Outlook (new) Feedback. Use this for feedback and suggestions for Outlook (new).

Use Outlook.com Feedback for suggestions or feedback about Outlook.com accounts.

Other Microsoft 365 applications and services




New Outlook Articles

Sync Issues and Errors with Gmail and Yahoo accounts

Error Opening iCloud Appointments in Classic Outlook

Opt out of Microsoft 365 Companion Apps

Mail Templates in Outlook for Windows (and Web)

Urban legend: Microsoft Deletes Old Outlook.com Messages

Buttons in the New Message Notifications

Move Deleted Items to Another Folder Automatically

Open Outlook Templates using PowerShell

Count and List Folders in Classic Outlook

Google Workspace and Outlook with POP Mail

Newest Code Samples

Open Outlook Templates using PowerShell

Count and List Folders in Classic Outlook

Insert Word Document into Email using VBA

Warn Before Deleting a Contact

Use PowerShell to Delete Attachments

Remove RE:, FWD:, and Other Prefixes from Subject Line

Change the Mailing Address Using PowerShell

Categorize @Mentioned Messages

Send an Email When You Open Outlook

Delete Old Calendar Events using VBA

Repair PST

Convert an OST to PST

Repair damaged PST file

Repair large PST File

Remove password from PST

Merge Two Data Files

Sync & Share Outlook Data

  • Share Calendar & Contacts
  • Synchronize two computers
  • Sync Calendar and Contacts Using Outlook.com
  • Sync Outlook & Android Devices
  • Sync Google Calendar with Outlook
  • Access Folders in Other Users Mailboxes

Diane Poremsky [Outlook MVP]

Make a donation

Mail Tools

Sending and Retrieval Tools

Mass Mail Tools

Compose Tools

Duplicate Remover Tools

Mail Tools for Outlook

Online Services

Calendar Tools

Schedule Management

Calendar Printing Tools

Calendar Reminder Tools

Calendar Dates & Data

Time and Billing Tools

Meeting Productivity Tools

Duplicate Remover Tools

Productivity

Productivity Tools

Automatic Message Processing Tools

Special Function Automatic Processing Tools

Housekeeping and Message Management

Task Tools

Project and Business Management Tools

Choosing the Folder to Save a Sent Message In

Run Rules on messages after reading

Help & Suggestions

Submit Outlook Feature Requests

Slipstick Support Services

Buy Microsoft 365 Office Software and Services

Visit Slipstick Forums.

What's New at Slipstick.com

Home | Outlook User | Exchange Administrator | Office 365 | Outlook.com | Outlook Developer
Outlook for Mac | Common Problems | Utilities & Addins | Tutorials
Outlook & iCloud Issues | Outlook Apps
EMO Archives | About Slipstick | Slipstick Forums
Submit New or Updated Outlook and Exchange Server Utilities

Send comments using our Feedback page
Copyright © 2026 Slipstick Systems. All rights reserved.
Slipstick Systems is not affiliated with Microsoft Corporation.