473,396 Members | 1,768 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,396 software developers and data experts.

Calculating the dwell time between two Records

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 Date
X1 1 01/01/05
X1 2 03/01/05
X1 3 10/01/05
X1 4 30/01/05
X2 1 12/02/05
Y1 1 14/03/05
etc

I would like to work out the dwell times inbetween each stage as a
cumulative and stage by stage figure, based on the PartID and working from
the first Date forwards
An example follows:

PartID Stage Date Dwell CDwell
X1 1 01/01/05 0 0
X1 2 03/01/05 2 2
X1 3 10/01/05 7 9
X1 4 30/01/05 20 29
X2 1 12/02/05 1 1
Y1 1 14/03/05 1 1
etc

I believe the best way to do this would be to use some sort of an embedded
query but I can't seem to addapt any of the ones I have.

If anyone can provide the SQL for this problem or point me in a direction
for help I would greatly appreciative,

Thanks,

John Ortt
Nov 13 '05 #1
1 1696
Think I have done it......I used the following code:

SELECT a.PartID, a.Date, a.Stage,min(b.Date) As Start, max(b.Date) As Last
FROM tblWorkability as a INNER JOIN tblWorkability as b ON (a.date>b.date)
AND (a.PartID=b.PartID)
GROUP BY a.PartID, a.Stage, a.Date;

All I need to do now is subtact the first and last stages from the date...

Thanks anyway everyone and if anyone has any other ways of doing it feel
free to let me know.

Cheers,

John

"John Ortt" <jo******@noemailsuppliedasdontwantspam.com> wrote in message
news:43**********@glkas0286.greenlnk.net...
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 Date
X1 1 01/01/05
X1 2 03/01/05
X1 3 10/01/05
X1 4 30/01/05
X2 1 12/02/05
Y1 1 14/03/05
etc

I would like to work out the dwell times inbetween each stage as a
cumulative and stage by stage figure, based on the PartID and working from
the first Date forwards
An example follows:

PartID Stage Date Dwell CDwell
X1 1 01/01/05 0 0
X1 2 03/01/05 2 2
X1 3 10/01/05 7 9
X1 4 30/01/05 20 29
X2 1 12/02/05 1 1
Y1 1 14/03/05 1 1
etc

I believe the best way to do this would be to use some sort of an embedded
query but I can't seem to addapt any of the ones I have.

If anyone can provide the SQL for this problem or point me in a direction
for help I would greatly appreciative,

Thanks,

John Ortt

Nov 13 '05 #2

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...
3
by: luscus | last post by:
Thanks for all the responses on my first question. Unfortunately the answers I was given were too complicated for my small brain , and neophite condition to understand. So if you could talk down to...
2
by: Tim Marshall | last post by:
Wondering if anyone has any suggestions for this. Sometimes in the form reports my users run, a data sheet subform on a main form, with totals in text boxes with calculated controlsources...
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...
2
by: dath | last post by:
Hi, Not really a programmer here, but have been forced into the role. I was asked to develop a basic time sheet for employees to enter time. I developed the Table without a problem. I then...
6
by: Adam1331 | last post by:
I am currently setting up a database for work that will operate as a timesheet. I have set up multiple tables, queries, forms and reports to help this process run smoothly. The issue that has...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.