Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Distinct in Access ?? Is not working

Status
Not open for further replies.

hello101

Instructor
Jun 26, 2006
18
0
0
US
Hi everyone,

I'm trying to run this query and it runs fun but returning the wrong results. I need to use Distinct on count in access and i don't know the syntax. if i add DISTINCT before count it does not work! Do i need to use a subquery?
Any ideas..

Tks in advance


SELECT D.DayOfYear, Count(S.M_ID) AS CountOfActive INTO [Return#ofMperdate]
FROM Mas AS D, Loan AS S
WHERE (((D.DayOfYear) Between #1/1/2006# And Date()) AND ((S.HIRE_DATE)<=[D].[DayOfYear]) AND ((S.TERM_DATE)>=[D].[DayOfYear] Or (S.TERM_DATE) Is Null))
GROUP BY D.DayOfYear;
 
Using GROUP BY, as you have here, should be the same as using DISTINCT - you don't need the DISTINCT command in this instance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top