Jim Lawrence
accessd at shaw.ca
Sat Jun 3 11:14:04 CDT 2006
So it is just a test against any a list of parts that have failed greater than ninety days and a list of parts that have failed less than ninety days. Does this have to have parts that have failed multiple times within ninety days? Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Francisco Tapia Sent: Friday, June 02, 2006 3:45 PM To: SQL Server 2k List; dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] Fun with T-Sql This really is a fun job, sometimes you won't find out what people want to report on.. :D. Generally i hate to sit and write reports, as it's always similar to one you just wrote but just enough diffrences that it needs to be a completely new report :|. today I'm writing one on a part list where i need to find parts that have failed a 2nd time within 90 days of the first failure :| so part a fails in 1/1/06, and fails again in 2/28/06... the 2/28 counts, but not the initial one. likewise, if a part fails again on 3/3/06, that counts as well because it's within 90 days of the 2/28 fail. fields are PN, FailDate Initially i'm gonna dump the fields to a temp table so I can work with a smaller subset of data. i think i should dump out the distinct pn list as well, i could create a while loop to find all pn that failed within 90 days of each other and dump out the ones that do not. so in my above example, if a part fails again at 7/1/06, that fail no longer counts as it's > 90 days since the last fail. not really expecting a reply just venting :) -- -Francisco http://pcthis.blogspot.com |PC news with out the jargon! http://sqlthis.blogspot.com | Tsql and More... _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com