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

need help to have the time difference interval

4
Below is the raw data in scarted order
Del No Time of Call
9985528355 6/17/2010 16:21
9985528359 6/12/2010 16:21
9985528305 6/7/2010 16:21
9985528255 5/28/2010 16:21
9985523255 5/22/2010 16:21
9985523255 5/18/2010 16:21
9915528255 5/8/2010 16:21
9915523255 5/2/2010 16:21
9915523255 4/29/2010 16:21
9915523255 4/28/2010 16:21

i am looking for below calucation in Access as mention below
i hav sorted with Del no and Time of call Ascending
In duplicate column formula is =A2=A1
In Diffs Hrs column formula is =+IF(B2=TRUE,C2-C1,"")
important feild is Diff Hrs
I am able to do through sub query but while exporting this table getting error that single record can be exported
Del No Duplicate Time of Call Diff Hrs
9915523255 FALSE 4/28/2010 16:21
9915523255 TRUE 4/29/2010 16:21 24:00:00
9915523255 TRUE 5/2/2010 16:21 72:00:00
9915528255 FALSE 5/8/2010 16:21
9985523255 FALSE 5/18/2010 16:21
9985523255 TRUE 5/22/2010 16:21 96:00:00
9985528255 FALSE 5/28/2010 16:21
9985528305 FALSE 6/7/2010 16:21
9985528309 FALSE 6/12/2010 16:21
9985528355 FALSE 6/17/2010 16:21

Urgent help required.
Thanx
May 18 '10 #1
7 1721
NeoPa
32,556 Expert Mod 16PB
You say Access, but this looks very like Excel data and formulas. Can you say exactly what problem you're getting and exactly what you're doing when you get it.

Welcome to Bytes!
May 18 '10 #2
vijaym
4
Yes its a excel data but the same i want to do in Access and my target output is Time diff
And i am able to do in Access through sub query but while exporting this table getting error as mention below
"At most one record can be returned by this sub Query"
May 19 '10 #3
NeoPa
32,556 Expert Mod 16PB
I'm sorry Vijay, but I'm really confused as to what you're trying to do. If you have a failure, it's a good idea to give details of exactly what you're trying. As you still haven't really explained whether it's an Excel or Access problem I can't even tell you what you need to include very easily. If it's a query (as you say) then at least we'd need the SQL of the query and the error message exactly as it appears.
May 19 '10 #4
vijaym
4
Hi Yes its a Access query problem
below is the query that i am trying to Execute but if its a small database query datasheet get export but while its a big database in lakhs than i gets a error as mention below in the Quotes
"At most one record can be returned by this sub Query"
Query
Expand|Select|Wrap|Line Numbers
  1. SELECT DatePart("h",DiffVal)  & ":"& 
  2.         DatePart("n",DiffVal) & ":" & 
  3.         DatePart("s",DiffVal) AS DiffVals, *
  4. FROM (SELECT  t1.*, 
  5.                     [t1].[Time of Call]-
  6.                     (
  7.                         SELECT  TOP 1 
  8.                                 Time of Call 
  9.                         FROM    Tagging_Dump 
  10.                         WHERE   Tagging_Dump.Del no = t1.Del no 
  11.                         AND     Tagging_Dump.Time of Call < t1.Time of Call 
  12.                         ORDER BY    Tagging_Dump.Time of Call DESC
  13.                     ) AS DiffVal 
  14.             FROM    Tagging_Dump AS t1
  15.         ) AS Tables
I am able to get the same in Excel but due limitation of row i want in Access
May 19 '10 #5
NeoPa
32,556 Expert Mod 16PB
There's a problem here Vijay.

Clearly somebody who was involved in designing this SQL doesn't need much help with SQL. There is some complicated (and clever) stuff in here. However, I can see that this SQL (as you've posted it) cannot run. Not because of any fundamental logic problem, but because some of the fields have spaces in their names without being enclosed in braces ([]), so they will be entirely misinterpreted by the SQL parser.

What is going on? Why is this SQL not what you have testing in the database? I cannot work with the wrong SQL.
May 19 '10 #6
vijaym
4
Expand|Select|Wrap|Line Numbers
  1. SELECT DatePart("h",DiffVal)  & ":"&
  2.         DatePart("n",DiffVal) & ":" &
  3.         DatePart("s",DiffVal) AS DiffVals, *
  4. FROM    (
  5.     SELECT t1.*,
  6.            [t1].[Time of Call]-
  7.            (
  8.         SELECT   TOP 1
  9.                  [Time of Call]
  10.         FROM     Tagging_Dump
  11.         WHERE    Tagging_Dump.[Del no] = t1.[Del no]
  12.           AND    Tagging_Dump.[Time of Call] < t1.[Time of Call]
  13.         ORDER BY Tagging_Dump.[Time of Call] DESC
  14.         ) AS DiffVal
  15.     FROM   Tagging_Dump AS t1
  16.     ) AS Tables
here is the correct code earlier braces were missing as i took this as a example
my problem is that unable to export the data if its in thousands else if it is a 10 to 20 rows data easily gets exported
May 25 '10 #7
NeoPa
32,556 Expert Mod 16PB
I've looked at this SQL and, not only do I see no problem with it, I also consider this pretty good work. Whoever produced this knew his stuff clearly. I can see no reason why there should be an error.

Can you try something for me and post the result here. I'd like you to paste this SQL exactly as is, into a new QueryDef in your database and try to execute it. Post here exactly what happens. If there is an error message then reproduce it exactly. If there is anything else that you notice, please post that too.
May 25 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: John | last post by:
Hi I am trying to find difference between two time values in hours. I have tried the following? ? dateDiff("h", #23:00:00#, #23:00:00#) gives 0 as expected. ? dateDiff("h", #00:00:00#,...
1
by: Sunny | last post by:
I am interested in finding out the time it takes to complete a certain section of my source code How do i determine the time difference between the beginning of a process and its end. I need to get...
1
by: Usman Ghani | last post by:
Hi There, I want to display below page creation time and so I have two variables as: Dim start_time As New DateTime Dim end_time As New DateTime First I am storing value in start_time on page...
3
by: Richard | last post by:
Hi, Is there any way to get the time difference between Central(US) and GMT in vb.net. I'll appreciate your help/suggestion. Thanks RC
2
by: cmrhema | last post by:
Hello I have a table GPSDATA which consists of VehicleNo,Speed,CurrentDate,slno,status This data gets updated every minute.And every minute the slno(serial no) will be incremented...
2
by: idealfellow | last post by:
I am using the following to get the time: puts Time.now --> starting of my script <MY CODE> puts Time.now --> end of my script I want to get the Time difference between two Time.now...
2
by: hridya | last post by:
can any one help me i want to ge the time difference betwwen two times eg: time1=12:10:10 time 2:=12:20:10 i want time2-time1
3
by: Steve | last post by:
I am trying to calculate elapsed travel times for flights. My plan is to enter the local departure time, the departure city and the local arrival time and city. These times would be standardised...
3
by: RN1 | last post by:
A Form has 2 TextBoxes where in users enter date & time. Example (in mm/dd/yyyy format): 09/20/2008 17:54 (1st TextBox) 09/29/2008 6:13 (2nd TextBox) How do I find out how much time (in...
2
by: Guruganesh | last post by:
i have to calculate the time diference of two file names namely File 1: CBE03KMD_2010_03_08_23_06_36.upl File 2: CBE03KMD_2010_03_08_22_11_47.upl see the date is same but the time is also...
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: 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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.