Hi,
If someone could please please help me, it would be greatly appreciated
I am trying to calculate the time a vehicle has stopped in one place.
this is the query that shows where a vehicle has stopped.. - SELECT
-
`vehiclehistory`.`Vehicle`,
-
`vehiclehistory`.`Date`,
-
`vehiclehistory`.`Time`,
-
`vehiclehistory`.`SpeedInst`,
-
`vehiclehistory`.`Suburb`,
-
`vehiclehistory`.`Street`,
-
`vehiclehistory`.`Latitude`,
-
`vehiclehistory`.`Longitude`,
-
`vehiclehistory`.`SpeedMax`,
-
`vehiclehistory`.`SpeedAv`,
-
`vehiclehistory`.`CourseInst`,
-
`vehiclehistory`.`CourseAv`
-
FROM
-
`vehiclehistory`
-
WHERE
-
`vehiclehistory`.`Vehicle` = "1008"
-
AND
-
`vehiclehistory`.`Date`= "2007-02-14"
-
AND
-
`vehiclehistory`.`SpeedInst` < "1"
-
AND
-
`vehiclehistory`.`CourseInst` = `vehiclehistory`.`CourseAv`
-
-
ORDER BY
-
`vehiclehistory`.`Time` ASC
-
This is a snippet of the data that comes out. - Vehicle Date Time SpeedInst Suburb Street Latitude Longitude SpeedMax SpeedAv CourseInst CourseAv
-
1008 14/2/2007 07:20:04 0 Punchbowl LUMEAH AV 33.56.187S 151.03.355E 0 0 0 0
-
1008 14/2/2007 07:22:34 0 Punchbowl ROSSMORE AV 33.55.930S 151.03.357E 0 0 305 305
-
1008 14/2/2007 07:25:36 0 Punchbowl ROSSMORE AV 33.55.930S 151.03.353E 0 0 305 305
-
1008 14/2/2007 07:28:38 0 Punchbowl ROSSMORE AV 33.55.931S 151.03.354E 0 0 305 305
-
1008 14/2/2007 07:46:50 0 Padstow VANNAN L 33.57.164S 151.01.798E 0 0 49 49
-
1008 14/2/2007 07:49:52 0 Padstow VANNAN L 33.57.164S 151.01.799E 0 0 49 49
-
1008 14/2/2007 07:52:54 0 Padstow VANNAN L 33.57.164S 151.01.799E 0 0 49 49
-
1008 14/2/2007 07:55:56 0 Padstow VANNAN L 33.57.164S 151.01.799E 0 0 49 49
-
1008 14/2/2007 07:58:58 0 Padstow VANNAN L 33.57.164S 151.01.799E 0 0 49 49
-
1008 14/2/2007 08:01:58 0 Padstow VANNAN L 33.57.164S 151.01.799E 0 0 49 49
-
1008 14/2/2007 08:04:14 0 Padstow VANNAN L 33.57.164S 151.01.799E 0 0 49 49
-
1008 14/2/2007 08:22:36 0 Revesby North FITZPATRICK ST 33.56.205S 151.00.175E 0 0 277 277
-
1008 14/2/2007 08:22:40 0 Revesby North FITZPATRICK ST 33.56.205S 151.00.175E 0 0 277 277
-
1008 14/2/2007 08:27:30 0 Revesby North FITZPATRICK ST 33.56.197S 151.00.149E 0 0 121 121
-
1008 14/2/2007 08:30:32 0 Revesby North FITZPATRICK ST 33.56.196S 151.00.149E 0 0 121 121
-
1008 14/2/2007 08:33:32 0 Revesby North FITZPATRICK ST 33.56.196S 151.00.150E 0 0 121 121
-
1008 14/2/2007 08:36:34 0 Revesby North FITZPATRICK ST 33.56.196S 151.00.150E 0 0 121 121
-
1008 14/2/2007 08:39:36 0 Revesby North FITZPATRICK ST 33.56.196S 151.00.150E 0 0 121 121
-
1008 14/2/2007 08:42:38 0 Revesby North FITZPATRICK ST 33.56.196S 151.00.149E 0 0 121 121
-
1008 14/2/2007 08:45:40 0 Revesby North FITZPATRICK ST 33.56.196S 151.00.149E 0 0 121 121
-
1008 14/2/2007 08:48:40 0 Revesby North FITZPATRICK ST 33.56.196S 151.00.149E 0 0 121 121
-
1008 14/2/2007 08:51:42 0 Revesby North FITZPATRICK ST 33.56.196S 151.00.149E 0 0 121 121
-
1008 14/2/2007 08:54:44 0 Revesby North FITZPATRICK ST 33.56.196S 151.00.149E 0 0 121 121
-
1008 14/2/2007 08:57:46 0 Revesby North FITZPATRICK ST 33.56.196S 151.00.149E 0 0 121 121
-
1008 14/2/2007 09:00:46 0 Revesby North FITZPATRICK ST 33.56.196S 151.00.149E 0 0 121 121
-
1008 14/2/2007 09:02:06 0 Revesby North FITZPATRICK ST 33.56.196S 151.00.149E 0 0 121 121
So what i am trying to do is group the stops together then get the total time the vehicle was stopped there.
So in Rossmore Ave, Punchbowl the vehicle was there from 07:22:34 to 07:28:38 = 6mins or so...
VANNAN L, Padstow 07:46:50 to 8:04:14 = 18 mins or so...
i hope this make sense....
Thank you in advance.
2 3837
Hi!
I have done it! ( I THINK....)
thank you for your help... timediff!!!!!
below is the query in case you or anyone who stumbles across the thread is interested.. - SELECT
-
MIN(`vehiclehistory`.`Time`),
-
MAX(`vehiclehistory`.`Time`) ,
-
-
timediff(MAX(`vehiclehistory`.`Time`) ,MIN(`vehiclehistory`.`Time`) ) as idle,
-
-
`vehiclehistory`.`Vehicle`,
-
`vehiclehistory`.`Date`,
-
`vehiclehistory`.`Time`,
-
`vehiclehistory`.`SpeedInst`,
-
`vehiclehistory`.`Suburb`,
-
`vehiclehistory`.`Street`,
-
`vehiclehistory`.`Latitude`,
-
`vehiclehistory`.`Longitude`,
-
`vehiclehistory`.`SpeedMax`,
-
`vehiclehistory`.`SpeedAv`,
-
`vehiclehistory`.`CourseInst`,
-
`vehiclehistory`.`CourseAv`
-
FROM
-
`vehiclehistory`
-
WHERE
-
`vehiclehistory`.`Vehicle` = "1008"
-
AND
-
`vehiclehistory`.`Date`= "2007-02-14"
-
AND
-
`vehiclehistory`.`SpeedInst` < "1"
-
AND
-
`vehiclehistory`.`CourseInst` = `vehiclehistory`.`CourseAv`
-
-
-
GROUP BY
-
`vehiclehistory`.`CourseAv`
-
-
ORDER BY
-
`vehiclehistory`.`Time` ASC
I know the group clause is incorrect.... will sort that out now...
Glad you sorted that out by yourself. Good luck!
Ronald :cool:
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Steve |
last post by:
Hi all
How would I find out the average date when given a bunch of dates? For
example, I want to find the average length in time from the following dates:...
|
by: sg_s123 |
last post by:
============================================================================
02-Feb-04 03-Feb-04
Staff Staff 0800hr- 1300hr- 1700hr- 1900hr- 0800hr- 1300hr- 1700hr-
1900hr-
Number...
|
by: Ladislau S. |
last post by:
Dear reader,
I am an occasional user of MS Access 2000 running on Windows 98. My hobby is
ship model building so I made a database for things that I want to buy.
After two strokes I bin unable...
|
by: |
last post by:
Hello,
I am hoping someone else has thought about a date time calculation i need to
perform.
I would like to be able to calculate the number of "working minutes" between
2 dates, given my...
|
by: kux |
last post by:
Hello everyone,
I hope someone is out here who can help me with a simple calculation...
I have a sales data base in access with monthly sales history by
product. to make future predictions I...
|
by: Jurek |
last post by:
I have 10+ experience in C/C++ - mostly automation and graphics. I have
never written any business apps though. Recently I've been asked to write a
simple report that would calculate sales...
|
by: reidarT |
last post by:
I have 3 fields in an aspx page. The 3. field should be the sum of field A
and field B
I use OnTextChanged to calculate the sum in field3.
At the same time I want to insert the content of theese 3...
|
by: gaga |
last post by:
hi guys,
a part of my program requires me to calculate an average of items that
are sold. the easiest way to do that would be writing a function, but
im having trouble making up the parameters. if...
|
by: muddasirmunir |
last post by:
how can we calculate data at run time in crystal report 10
i had made three fields in my database name
debit,credit , balance
debit and credit shows data directly from database now i want
a...
|
by: SuzK |
last post by:
I am trying to calculate in VBA in Access 2002 a moving average and update a table with the calculations. Fields in my WeeklyData table are
Week Ending (date)
ItemNbr (double)
Sales Dollars...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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...
|
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: 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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |