If I need to write a queary to count the number of "reprintx" with a time trend (This is a calucation of the difference between Process Time vs Reprint Time, where time is greater than 5 mins count the record) I need to show the number of time "reprintx" are done after 5 mins of the original. Do I need to incorp. the Datediff statement? I found the two columns "process time" and "reprintx time" Any help to jump start will help. Thanks,
It looks like TIMESTAMPDIFF may be your best bet. DateDiff on returns the number of days, not minutes, with TimestampDiff you can specify the unit. Select * From table Where TIMESTAMPDIFF(MINUTE, processTime, reprintTime) > 5
Is there a new row created with each reprint, or is the reprint column updated each time a reprint is done?
Yes, there's a new row for each reprint during the month. A month could have 20+ ** one more thing .... I can extract the month and year in a datetime with no problem "select extract (year from attempt_date)AS Years" but I can't extract just the TIME from the datetime .... dont I need to minus the two diff? reprint time and process time but the mm/dd/yy is in the time line too long with the time "05/12/2012 11:13:56" Process Time "05/12/2012 15:11:34" Reprint Time Don't I need to somehow calculate the different between the two to get "over 5mins"
If the data is on separate rows then you'll need to join the table to itself to compare the dates, I'm assuming there is some sort of ID that allows you to tell that two records are related along with a unique id for each row. It would help if you could list the columns you have that are used in the process.
To me it sounds like you need to first filter your query to just show the rows of the printout you are looking at, like Dr. Luda said. Some PrintID or something that represents the same print job/document. ASSUMPTION: All the "Process Time" values should be the same representing when the first/original printing happened right? So just sort your query by reprint time. Filter out any times that are less than ProcessTime + 5 mins. The row count is how many reprints you had 5 minutes past your original print time. You shouldn't need to parse your date at all, if you are just looking for the number of reprints.
"Luckyazn - My life with SQL" A heart-warming tale about a man and his daily confrontations with SQL, narrated by Morgan Freeman. Giving a great look into the stereotypes about Asians, computers and their struggles this book will hook you with it's original style, anecdotes and a great portion of humor. Written by the author of the NY Times bestseller "Being Asian on ClutchFans - a shocking story about ignorance and racism in our society". Oprah Winfrey: "This book will change the way how people think about Asians in our society. We assume they are masters in everything related to computers and math but these are blatant stereotypes that hurt Asians the most and put them under great pressure to perform up to the standards that we lay on them." "Luckyazn - My life with SQL" In stores Fall, 2012.
Apparently he's gotten through life using luck. We do like to gamble. I'm just joking Luckyazn. We do like to gamble though.
Ok finally got it to work. I added the statement: Count (reprintx_ticket) as Reprintx Where AND ((reprintx_ticket - process_ticket) * 1440) > 4.3 Now I get the number of "Reprintx" in a time frame by each employees but now I might need help on this one: Number of times the employee void a ticket that was already voided on a given day?
Would it be Void_Ticket - 1 ? Since the first one would be the first reprint? If I'm trying to get the total