Select First Date Entered if Date Field Is Null

L

Laura C.

Hi,

I'm trying to build a query that will show me the first date on which a
person was elected to a particular position in the company.

The SQL currently looks like this:

SELECT tblMaster.tblNames_ID, tblMaster.tblTitles_ID, tblTitles.Seniority,
Min(tblMaster.[First Elected Date]) AS [MinOfFirst Elected Date]
FROM tblTitles INNER JOIN tblMaster ON tblTitles.ID = tblMaster.tblTitles_ID
GROUP BY tblMaster.tblNames_ID, tblMaster.tblTitles_ID, tblTitles.Seniority
ORDER BY tblMaster.tblNames_ID, tblTitles.Seniority;


The problem is that some of the date fields (tblMaster.[First Elected Date])
are null, since the election date is unknown. When I run the query, I get the
null value as the "Min" instead of the first known date.

I tried entering a patently false date (2/22/2222) -- one much later than
any conceivable election date -- in all of the blank rows, but the query does
not seem to be recognizing this date.

Can you help me rewrite so that if the date field is null, the query returns
the earliest date that has been entered (i.e., the next earliest date)?

Thanks in advance!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top