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

Need to Count total Records found in a Query

Status
Not open for further replies.

Texmansru47

IS-IT--Management
Jul 19, 2005
30
US
All,

I have the need to run a query to pull a certain date range. Within that query I will find all the failed records. Now I can get the date to run interactively (only one date at a time right now, looking for date range, but not important), but what I need to do is to calculate percentage of each type of failure found based on the date range inputted (i.e. if I selected 7/13/05 as the date, and it found 6 failures, with three different error codes, I need to be able to calculate the percentage each error was during that selected date range).

I can get the dates to pull and the count of each error code per date... I just cannot get the percentage to work... any ideas?

Thanks,
 
could you post the query you have that gets the count?

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual
 
Here is what I have thus far:

SELECT PostModelFail.Date, Count(PostModelFail.PostmodelID) AS CountOfPostmodelID, PostModelFail.FailCodeID
FROM PostModelFail
GROUP BY PostModelFail.Date, PostModelFail.FailCodeID
HAVING (((PostModelFail.Date)=[Enter Date For Report]))
ORDER BY PostModelFail.Date, Count(PostModelFail.PostmodelID), PostModelFail.FailCodeID;


Thanks,

Tom
 
Something like this ?
SELECT [Date], Count(*) AS CountOfPostmodelID, FailCodeID, Count(*)/DCount('*','PostModelFail','[Date]=#' & [Enter Date For Report] & '#') AS Percentage
FROM PostModelFail
WHERE [Date]=[Enter Date For Report]
GROUP BY [Date], FailCodeID
ORDER BY 1, 2, 3;

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top