Solved

How exclude record in query if two fields are null

Posted on 2014-07-28
3
986 Views
Last Modified: 2014-07-28
I have a query that includes to fields, for example...  Date1 and Date2

If either of these date fields have a date in them I want the record to be included in the query result.  But if BOTH of the date fields are null I do not want the record to be included in the result.

How can this be done?
0
Comment
Question by:SteveL13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 21

Expert Comment

by:Randy Poole
ID: 40224330
select * from yourtable where not isNull(Date1) or not isNull(Date2)
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 40224335
add a Where clause

WHERE ((DATE1 Is Not Null) AND (DATE2 Is Not Null)) OR ((DATE1 Is Not Null)) OR ((DATE2 Is Not Null))
0
 
LVL 33

Expert Comment

by:ste5an
ID: 40224336
Add an appropriate WHERE condition. E.g.
WHERE NOT (IsNull([Date1]) AND IsNull([Date2]))

Open in new window

.
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question