Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4015688
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:38:58+00:00 2026-05-20T09:38:58+00:00

I have a table with an object, index, date and value: +————–+——-+————+————+ | object

  • 0

I have a table with an object, index, date and value:

+--------------+-------+------------+------------+
| object       | index | date       | value      |
+--------------+-------+------------+------------+
| 32           | 1     | 2011-02-25 | 2100000000 | 
| 32           | 2     | 2011-02-25 | 27800000   | 
| 32           | 3     | 2011-02-25 | 5700000    | 
| 32           | 1     | 2011-02-26 | 2100000000 | 
| 32           | 2     | 2011-02-26 | 28700000   | 
| 32           | 3     | 2011-02-26 | 5800000    | 
| 32           | 1     | 2011-02-27 | 2200000000 | 
| 32           | 2     | 2011-02-27 | 29500000   | 
| 32           | 3     | 2011-02-27 | 5900000    | 
+--------------+-------+------------+------------+

and I need a query with the difference of the value between two consecutive days for every objectindex
so something like this

+--------------+-------+------------+------------+
| object       | index | date       | value_24h  |
+--------------+-------+------------+------------+
| 32           | 1     | 2011-02-26 | 0          | 
| 32           | 2     | 2011-02-26 | 0          | 
| 32           | 3     | 2011-02-26 | 100000     | 
| 32           | 1     | 2011-02-27 | 100000000  | 
| 32           | 2     | 2011-02-27 | 800000     | 
| 32           | 3     | 2011-02-27 | 100000     | 
+--------------+-------+------------+------------+

Is this possible in mysql or do I better calculate these values in my program (python).
Or would a different/better table layout help?

Thanks,
Michael

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T09:38:59+00:00Added an answer on May 20, 2026 at 9:38 am
    SELECT t2.object,t2.index,t2.date,t2.value-t1.value
    FROM table t1, table t2
        WHERE t1.object=t2.object AND t1.index=t2.index
            AND t2.date=DATE_ADD(t1.date, INTERVAL 1 DAY);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Generic List object which hold below table as its own value.
Apologies for the vague question. Here it is: I have a table object created
I have a data.table object like this one library(data.table) a <- structure(list(PERMNO = c(10006L,
I have a data.table object similar to this one library(data.table) c <- data.table(CO =
I have the following database table object: public class Goal { @DatabaseField(generatedId = true)
I have a table declaration: TYPE PERSON_TYPE AS OBJECT (ID NUMBER(38), NAME VARCHAR2(20)); TYPE
I have a table with 50 rows in a QTextEdit object. Removing 50 rows
I have fetched the contents of a table in array of object. And the
When creating or editing object sin my table, I have a jquery dialog that
I have a table with with 7,526,511 records with the following definition: /****** Object:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.