Hi,
Need your help on the following..
I have a assets database in Access. Want to calculate the number of failure incidents happened on a particular asset and for how much duration such failure was through MS access SQL...
Giving the database structure in the file attached. Along with the expected resolution...
Kindly assist on this..
Thanks in advance...
Last edited by NBVC; 04-26-2011 at 10:05 AM. Reason: OP changed title in wrong post.
Suggest you post your actual db so that we can manipulate the queries. I envision a couple of aggregate queries and finally a union query to bring it all together. If you post the actual db, then the exact SQL statements can be provided.
Alan
Alan
Click the * below to say thanks.
Database Principles
Pivot Table Tips
Good Excel Video Tutorials
Sumifs or SumProduct
DataPig Access Tutorials
MS Query Tutorial
Worst Pie Chart Ever?
Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.
PLEASE PM WHEN YOU HAVE DONE THIS AND I WILL DELETE THIS POST
Microsoft MVP - Excel
Where there is a will there are many ways. Pick One!
Please read the Forum Rules
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
Preferred Charities: Lupus Canada and Sick Kids Foundation.
Feel Free to Donate if you want to, for the assistance you received today.
Hi,
Thanks for the response. Attaching the actual DB for the resolution..
Applogies for not using the title of the query approprietly...Will take this into consideration in all my post going forward...
Hope to get the response soon on this...
Thanks,
Last edited by excelhelp18; 04-26-2011 at 06:34 AM.
Please change the current thread title.
Microsoft MVP - Excel
Where there is a will there are many ways. Pick One!
Please read the Forum Rules
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
Preferred Charities: Lupus Canada and Sick Kids Foundation.
Feel Free to Donate if you want to, for the assistance you received today.
This SQL statement should give you the expected results that you requested.
Open a new query, add the Assets table. Click on the drop down in the upper left corner of the QBE and select SQL. Paste the above code and then switch back to design to see how you would have designed in the QBE. Click on the data sheet icon for results.SELECT Assets.Zone, Assets.Cluster, Count(Assets.[PIU Failure]) AS [CountOfPIU Failure], Sum(Assets.[PIU Failure]) AS [SumOfPIU Failure], Count(Assets.[DG Failure]) AS [CountOfDG Failure], Sum(Assets.[DG Failure]) AS [SumOfDG Failure] FROM Assets GROUP BY Assets.Zone, Assets.Cluster;
Alan
Alan
Click the * below to say thanks.
Database Principles
Pivot Table Tips
Good Excel Video Tutorials
Sumifs or SumProduct
DataPig Access Tutorials
MS Query Tutorial
Worst Pie Chart Ever?
Thanks for the reply..
The query provided by you, does count the total instances of Assets failure with total duration...what I am looking for is the count of unique/distinct sites instances of assets failure with total duration...
Have attached the excel as well as the access DB for your support...Excel with provide you with the exact solution I am looking for through using access..
Thanks in advance..
This appears to be close. You will need to check the details.
Alan
Click the * below to say thanks.
Database Principles
Pivot Table Tips
Good Excel Video Tutorials
Sumifs or SumProduct
DataPig Access Tutorials
MS Query Tutorial
Worst Pie Chart Ever?
Thanks for the reply..but this is not as per my requirement..
For Cluster "CHAMBA", the CountOfPIU Failure is showing 2 whereas it should be 1 as I am looking for distinct SiteId (RKAT01) having the failure.
Your response is taking the count of SiteId (RKAT01) as 2..want to capture the siteId count as unique...
Similarly for cluster "NAHAN", the SiteId (KAMB02) is repeated and hence it should be counted as 1 and subsequently CountOfDG Failure for "NAHAN" cluster should be 8 and not 9 as shown by the query you developed..
Kindly help on this..
Thanks..
Hi,
Use Query: "qry_Result" should give you what you want.
Tony
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks