MySQL Forums
Forum List  »  Microsoft Access

Re: distinct
Posted by: Sebastien Caisse
Date: April 05, 2006 04:21AM

If you remove it from the SELECT columns part you need to add it to the GROUP BY columns part!

SELECT tblCasesMain.CaseNum, First(tblCasesMain.OldCaseNum) AS FirstOfOldCaseNum, First(tblCasesMain.CaseStatus) AS FirstOfCaseStatus, First(tblCasesMain.Incident) AS FirstOfIncident, tblNameslst.LastName, tblNameslst.FirstName, tblNameslst.Company, First(tblCasesMain.OpenDate) AS FirstOfOpenDate, First(tblCasesMain.CloseDate) AS FirstOfCloseDate, First(tblCasesMain.PendingDate) AS FirstOfPendingDate, First(tblBalances.InitBal) AS FirstOfInitBal, First(tblCasesMain.Exposure) AS FirstOfExposure
FROM ((tblCasesMain LEFT JOIN tblPaymentslst ON tblCasesMain.CaseNum = tblPaymentslst.CaseNum) LEFT JOIN tblBalances ON tblCasesMain.CaseNum = tblBalances.CaseNum) LEFT JOIN tblNameslst ON tblCasesMain.CaseNum = tblNameslst.CaseNum
GROUP BY tblCasesMain.CaseNum, tblNameslst.LastName, tblNameslst.FirstName, tblNameslst.Company, tblPaymentslst.PaymentAmount
ORDER BY tblCasesMain.CaseNum, tblNameslst.LastName, tblNameslst.FirstName, tblNameslst.Company;

You might also want to add it to the ORDER BY column list...



Edited 2 time(s). Last edit at 04/05/2006 04:22AM by Sebastien Caisse.

Options: ReplyQuote


Subject
Views
Written By
Posted
8500
October 12, 2004 09:56AM
3259
October 12, 2004 01:25PM
2643
November 09, 2005 07:58PM
2336
March 31, 2006 08:41AM
2357
March 31, 2006 02:45PM
2430
April 03, 2006 07:28AM
2263
April 03, 2006 07:51AM
2321
April 03, 2006 11:58AM
Re: distinct
2150
April 05, 2006 04:21AM
2189
April 05, 2006 11:57AM
2196
April 05, 2006 04:53PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.