473,386 Members | 1,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Calculating consecutive Date/Time records

I have a query that returns the results of a process. The start time
for Step 2 is the End Time for step 1. I need to know how long each
step takes.

My current query

Product Step
24324201-05 Step1 7/31/2007 12:11:53 AM
24324201-05 Step2 7/31/2007 12:12:00 AM
24324201-05 Step3 7/31/2007 12:12:21 AM

Aug 13 '07 #1
3 2624
On Aug 13, 3:32 pm, turtle <kol...@vistacontrols.comwrote:
I have a query that returns the results of a process. The start time
for Step 2 is the End Time for step 1. I need to know how long each
step takes.

My current query

Product Step
24324201-05 Step1 7/31/2007 12:11:53 AM
24324201-05 Step2 7/31/2007 12:12:00 AM
24324201-05 Step3 7/31/2007 12:12:21 AM
What i want to do is calculate the difference from step 1 to step 2 on
the first record and then the dif between step 2 and step 3 on the 2nd
record.
thanks
KO

Aug 13 '07 #2
select A.product, 'Step' & count(*) as StepNbr, A.step
from
(
select product, step
from products
) as A
inner join
(
select product, step
from products
) as B
on A.product = B.product
and A.Step >= B.Step
group by A.product, A.step

turtle wrote:
I have a query that returns the results of a process. The start time
for Step 2 is the End Time for step 1. I need to know how long each
step takes.

My current query

Product Step
24324201-05 Step1 7/31/2007 12:11:53 AM
24324201-05 Step2 7/31/2007 12:12:00 AM
24324201-05 Step3 7/31/2007 12:12:21 AM
Aug 14 '07 #3
or:

select A.product, 'Step' & count(*) as StepNbr, A.step
from products as A
inner join products as B
on A.product = B.product
and A.Step >= B.Step
group by A.product, A.step

John Winterbottom wrote:
select A.product, 'Step' & count(*) as StepNbr, A.step
from
(
select product, step
from products
) as A
inner join
(
select product, step
from products
) as B
on A.product = B.product
and A.Step >= B.Step
group by A.product, A.step
Aug 14 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Ron Adam | last post by:
Hi, I'm having fun learning Python and want to say thanks to everyone here for a great programming language. Below is my first Python program (not my first program) and I'd apreciate any...
1
by: John Ortt | last post by:
Hi There, I'm trying to work out the dwell between stages in our process. We have a table (Workability) which records progress of parts through the factory as follows: PartID Stage ...
2
by: Prakash | last post by:
I have 2 tables ... Customer_Master: Cust-Code, Cust_Name Customer_Transactions: Cust_Code, Date, Details, Debit, Credit I would like to generate a report in the foll manner, say from...
3
by: Wired Hosting News | last post by:
Lets say I have 10 products in 10 different stores and every week I get a report from each store telling me how many items they have left for each of the 10 products. So each week I enter in 100...
5
by: Wired Hosting News | last post by:
I tried to be breif and give a scenario so as not to be overlooked because it was soooo long. Let me give you real world. I am a manufacturer of goods and produce 11 items that are distributed...
1
by: Nixeh | last post by:
Hey guys, New to the forums but ive hit a snag whilst updating a Access Database at work. Currently trying to repair and maintain a database that has been built by 6 people all with even worse...
8
by: King | last post by:
Hi I have following MS Acess query Here is the query ID Name Prgm ID Client ID Date Start Time End Time Minutes C4 Trisha TIP DEK0703 7 /7 /2006...
3
by: Nelson | last post by:
Hi All, I want to look at what happens to stock prices after a certain number of consecutive up or down days. Let's say, for instance, I'd like to see where a stock's price is 5 days after a...
1
by: rodneyeid | last post by:
Hi, I have an attendance machine which saves records in an Access Database in the following format : UserID DATE/TIME Checktype where if checktype is 0 then its check in and if it is 1 then it...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.