473,503 Members | 1,735 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Mysql Subquery

1 New Member
I have an issue that I would like help to solve:

I have the following table

Name Time Amount
Jack 00:15 10
Ray 00:15 12
Jack 00:30 12
Ray 00:30 15
Jack 00:45 13
Ray 00:45 17

The issue I am facing is that I need to take the delta of the amount column as this value is a running sum and I need to have the data in the following form:

Name Time Amount
Jack 00:30 2
Ray 00:30 3
Jack 00:45 1
Ray 00:45 2

What I am doing here is I am taking the value for each name ahead of time and subtracting it to the time before in this above example for Jack the amount for time 00:15 was 10 and for 00:30 it was 12 so the new value is 2 the difference of the time in advance to the previous one.

How can I write a query to do this?

Many thanks for your help and Merry Christmas

BR, Ray
Dec 25 '06 #1
1 1273
ronverdonk
4,258 Recognized Expert Specialist
You are double posting in this forum!!

Please read the Posting Guidelines before you post in this forum!

moderator :cool:
Dec 25 '06 #2

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

Similar topics

3
7538
by: Benjamin Dickgießer | last post by:
Hi, I want to create a sql query but don't know if this is possible with mysql. The Query should do the following: Select all db entries from table in which entry a is smaller than the number...
6
1730
by: Bob Bedford | last post by:
I've a table on mysql: code1 tinyint, code2 tinyint, notcode1 varchar(20),notcode2 varchar(20),label I do have some records: values(1,null,null,null,'text1');...
0
3924
by: Mike Chirico | last post by:
Interesting Things to Know about MySQL Mike Chirico (mchirico@users.sourceforge.net) Copyright (GPU Free Documentation License) 2004 Last Updated: Mon Jun 7 10:37:28 EDT 2004 The latest...
2
1613
by: Arc | last post by:
Sorry if this has been gone over before, but I checked google groups and I couldn't find anything. Does anyone here have any idea when 4.1.x will be released into production (i.e. come out of...
175
11198
by: Sai Hertz And Control Systems | last post by:
Dear all, Their was a huge rore about MySQL recently for something in java functions now theirs one more http://www.mysql.com/doc/en/News-5.0.x.html Does this concern anyone. What I...
57
25466
by: Bing Wu | last post by:
Hi all, I am running a database containing large datasets: frames: 20 thousand rows, coordinates: 170 million row. The database has been implemented with: IBM DB2 v8.1
39
8367
by: Mairhtin O'Feannag | last post by:
Hello, I have a client (customer) who asked the question : "Why would I buy and use UDB, when MySql is free?" I had to say I was stunned. I have no experience with MySql, so I was left sort...
11
1702
by: Sinan Osan | last post by:
Hello, I want to select the users from 'userTBL' which does not have any property in 'live_properties' table, Both table has a same column called 'username' I have 2 tables called...
4
6228
by: Diogenes | last post by:
Kind readers, I am currently developing an app with PHP 5 & MySql 5. The following select statement works as expected from the MySql command line but produces an error when run from PHP. ...
0
1196
by: yuan22m | last post by:
Hi I have encounter problem in mysql with my query regarding subquery support. The IN and NOT IN are not supported. my client's server is running the old version of mysql and he cant upgrade...
0
7199
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
7323
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...
1
6984
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
5576
agi2029
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,...
1
5005
isladogs
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...
0
4670
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3162
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3151
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1507
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.