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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Distinct Date Totals 1

Status
Not open for further replies.

netrusher

Technical User
Joined
Feb 13, 2005
Messages
952
Location
US
Below is the code I currently have that select distinct
Dates from my table based on a date range. There is a total
of 171 unique dates in this query. My question is how can
I create a query that will just give me the total of 171
instead of showing each date?


Code:
SELECT DISTINCT [All gages].[DATE DUE]
FROM [All gages]
WHERE ((([All gages].[DATE DUE]) Between #3/1/2008# And #3/31/2009#))
ORDER BY [All gages].[DATE DUE];
 
SELECT Count(*) AS CountOfDistinctDates
FROM (
SELECT DISTINCT [DATE DUE] FROM [All gages]
WHERE [DATE DUE]) Between #2008-03-01# And #2009-03-31#
) AS C

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Sorry for the typo:
SELECT Count(*) AS CountOfDistinctDates
FROM (
SELECT DISTINCT [DATE DUE] FROM [All gages]
WHERE [DATE DUE] Between #2008-03-01# And #2009-03-31#
) AS C

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top