[dba-SQLServer] Fun with T-Sql

Francisco Tapia fhtapia at gmail.com
Fri Jun 2 17:45:20 CDT 2006


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...



More information about the dba-SQLServer mailing list