- My Forums
- Tiger Rant
- LSU Recruiting
- SEC Rant
- Saints Talk
- Pelicans Talk
- More Sports Board
- Fantasy Sports
- Golf Board
- Soccer Board
- O-T Lounge
- Tech Board
- Home/Garden Board
- Outdoor Board
- Health/Fitness Board
- Movie/TV Board
- Book Board
- Music Board
- Political Talk
- Money Talk
- Fark Board
- Gaming Board
- Travel Board
- Food/Drink Board
- Ticket Exchange
- TD Help Board
Customize My Forums- View All Forums
- Show Left Links
- Topic Sort Options
- Trending Topics
- Recent Topics
- Active Topics
Started By
Message
Any Access wizards in here?
Posted on 6/2/22 at 2:38 pm
Posted on 6/2/22 at 2:38 pm
Working on a database for tracking equipment reliability. I have two tables. One is the equipment info table, and the other is a table that contains a record for each failure across the population of equipment. Im trying to figure out how to make a query that lists the equipment with at least 3 failures over a period of time. Can anybody point me in the right direction?
Posted on 6/2/22 at 3:08 pm to Shwapp
find the primary key in both databases (i.e. product ID), then you will use a left join based on that primary key. From there you should have a table with duplicate product IDs (i.e. rows) for equipment with multiple failures. From there, you can do a couple of things do query out products IDs listed more than 2 times.
(This is all assuming those tables are how I think they are in my head).
ETA: If your tables have foreign keys (multiple columns in both fields that relate the tables to one another) that would be better than using a primary key.
(This is all assuming those tables are how I think they are in my head).
ETA: If your tables have foreign keys (multiple columns in both fields that relate the tables to one another) that would be better than using a primary key.
This post was edited on 6/2/22 at 3:24 pm
Posted on 6/4/22 at 6:35 am to Shwapp
Not sure if you still needed this. Assuming you have 2 tables:
equipment - fields are equipmentid and equipment description.
failures - fields are failureid, equipmentid_fk, failuredescription, and failuredate.
A possible query to get you what you want would be:
SELECT e.equipmentdescription, Count(f.equipmentid_fk) AS CountOfequipmentid_fk
FROM equipment AS e, failures AS f
WHERE (((e.equipmentid)=[f].[equipmentid_fk]) AND ((f.failuredate)>=#6/1/2022# And (f.failuredate)<=#6/3/2022#))
GROUP BY e.equipmentdescription
HAVING (((Count(f.equipmentid_fk))>=3));
Should you get all part descriptions and a count of the failures with 3 or more between 06/01/2022 and 06/03/2022.
equipment - fields are equipmentid and equipment description.
failures - fields are failureid, equipmentid_fk, failuredescription, and failuredate.
A possible query to get you what you want would be:
SELECT e.equipmentdescription, Count(f.equipmentid_fk) AS CountOfequipmentid_fk
FROM equipment AS e, failures AS f
WHERE (((e.equipmentid)=[f].[equipmentid_fk]) AND ((f.failuredate)>=#6/1/2022# And (f.failuredate)<=#6/3/2022#))
GROUP BY e.equipmentdescription
HAVING (((Count(f.equipmentid_fk))>=3));
Should you get all part descriptions and a count of the failures with 3 or more between 06/01/2022 and 06/03/2022.
This post was edited on 6/4/22 at 6:46 am
Posted on 6/7/22 at 10:18 am to Mingo Was His NameO
$5k for a license to do something that can be done in Access or SQL?
Alteryx has some cool stuff, but mostly appears to be a GUI for a less than competent DBA.
Alteryx has some cool stuff, but mostly appears to be a GUI for a less than competent DBA.
Posted on 6/7/22 at 7:00 pm to Shwapp
Why not export the data to excel and do this?
Posted on 6/8/22 at 2:19 pm to jdd48
quote:
WHERE (((e.equipmentid)=[f].[equipmentid_fk]) AND ((f.failuredate)>=#6/1/2022# And (f.failuredate)<=#6/3/2022#))
In the "WHERE" part of the clause, is there a reason for the brackets around [f].[equipmentid_fk], and could I use the following for my failure date parameters?
WHERE (((e.Func_Loc)=[f].[Func_Loc]) AND ((f.Failure_Date)>=(Date()-1095) And (f.Failure_Date)<=Date())
Posted on 6/8/22 at 2:51 pm to Shwapp
Not sure if that will work, but you can use DateAdd - DateAdd (d,-1095,Date()).
Popular
Back to top
