Page 1
Page 1
Started By
Message

Any Access wizards in here?

Posted on 6/2/22 at 2:38 pm
Posted by Shwapp
Gonzales, LA
Member since Sep 2016
958 posts
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 by gaetti15
AK
Member since Apr 2013
14050 posts
Posted on 6/2/22 at 3:08 pm to
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 post was edited on 6/2/22 at 3:24 pm
Posted by Mingo Was His NameO
Brooklyn
Member since Mar 2016
29689 posts
Posted on 6/2/22 at 8:36 pm to
Alteryx
Posted by jdd48
Baton Rouge
Member since Jan 2012
22831 posts
Posted on 6/4/22 at 6:35 am to
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.
This post was edited on 6/4/22 at 6:46 am
Posted by WhiskeyThrottle
Weatherford Tx
Member since Nov 2017
6450 posts
Posted on 6/7/22 at 10:18 am to
$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.
Posted by Corporal Beavis
Member since Aug 2013
1239 posts
Posted on 6/7/22 at 7:00 pm to
Why not export the data to excel and do this?
Posted by Shwapp
Gonzales, LA
Member since Sep 2016
958 posts
Posted on 6/8/22 at 2:19 pm to
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 by Brisketeer
Texas
Member since Aug 2013
1554 posts
Posted on 6/8/22 at 2:51 pm to
Not sure if that will work, but you can use DateAdd - DateAdd (d,-1095,Date()).
first pageprev pagePage 1 of 1Next pagelast page
refresh

Back to top
logoFollow TigerDroppings for LSU Football News
Follow us on X, Facebook and Instagram to get the latest updates on LSU Football and Recruiting.

FacebookXInstagram