Problem with UNION query and DISTINCT

June 11, 2009 at 17:04:14
Specs: Windows XP

I have the following UNION query in MS Access:

SELECT DISTINCT "DOM " & mDOMExceptions.ExceptionID as ExceptionID, mDOMExceptions.[Status], mDOMExceptions.[Date Created], mDOMExceptions.LastUpdate, sDOMExceptionComments.Date, sDOMExceptionComments.User, sDOMExceptionComments.Location, sDOMExceptionComments.Comment
FROM mDOMExceptions INNER JOIN sDOMExceptionComments ON mDOMExceptions.ExceptionID = sDOMExceptionComments.ExceptionID
SELECT DISTINCT "WOM " & mWOMExceptions.ExceptionID as ExceptionID, mWOMExceptions.[Status], mWOMExceptions.[Date Created], mWOMExceptions.LastUpdate, SWOMExceptionComments.Date, sWOMExceptionComments.User, sWOMExceptionComments.Location, sWOMExceptionComments.Comment
FROM mWOMExceptions INNER JOIN sWOMExceptionComments ON mWOMExceptions.ExceptionID = sWOMExceptionComments.ExceptionID;

I am trying to get a list of the "exceptions" but only showing their most recent comment.

When I run the query, I will get the following:

ExceptionID Status Date Created LastUpdate Date User Location Comment
WOM 52 Bring into Office 04.06.2009 04.06.2009 2:01:26 PM testUser1 Warehouse this item is missing its battery also
WOM 52 Bring into Office 04.06.2009 10.06.2009 2:24:11 PM testUser2 Office Please bring into office.

See More: Problem with UNION query and DISTINCT

Report •

June 11, 2009 at 19:53:38
Problem solved

Report •

June 15, 2009 at 13:22:29
Great! Can you share the solution here so others can benefit from it? Please?;en-us;555375
How to ask a question.

Report •
Related Solutions

Ask Question