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

  • Home
  • SEARCH
  • 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 7871017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:47:13+00:00 2026-06-03T01:47:13+00:00

I have some historical data tables in my Mysql database. I want to repeat

  • 0

I have some historical data tables in my Mysql database.

I want to repeat a day’s historical data for another day in the same table.

Table structure, with some sample data:

 Id | Date       | Value

  1 | 2012-04-30 |     5
  2 | 2012-04-30 |    10
  3 | 2012-04-30 |    15

I want to repeat those ids & values, but for a new date – e.g. 2012-05-01. i.e. adding:

  1 | 2012-05-01 |     5
  2 | 2012-05-01 |    10
  3 | 2012-05-01 |    15

I feel that there should be a straightforward way of doing this… I’ve tried playing with UPDATE statements with sub-queries and using multiple LEFT JOINs, but haven’t get there yet.

Any ideas on how I can do this?

EDIT: To clarify…
– I do NOT want to add these to a new table
– Nor do I want to change the existing records in the table.
– The ids are intentionally duplicated (they are a foreign_key to another table that records what the data refers to…).

  • 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-06-03T01:47:15+00:00Added an answer on June 3, 2026 at 1:47 am
    INSERT INTO yourTable
    SELECT ID, "2012-05-01" As Date, Value
    FROM yourTable
    WHERE Date = "2012-04-31"
    

    Usually, your ID would be an autoincrement though, so having the same ID in the same table would not work. Either use a different ID, or a different table.

    Different ID (next autoincrement):

    INSERT INTO yourTable
    SELECT NULL as ID, "2012-05-01" As Date, Value
    FROM yourTable
    WHERE Date = "2012-04-31"
    

    Different table (referring to original ID)

    INSERT INTO yourTable_hist
    SELECT NULL as ID, ID as old_ID, "2012-05-01" As Date, Value
    FROM yourTable
    WHERE Date = "2012-04-31"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 2 tables, one that holds records with some data related to it
I have a table (client) with 20+ columns that is mostly historical data. Something
I have some MySQL databases that have several tables that contain (amongst others) some
I have some historical option prices and I'm trying to determine an implied delta.
I have some XML which contains records and sub records, like this: <data> <record
I have some data with one row of headers and one or more rows
For historical reasons, I have some WSE 3.0 web services that I cannot upgrade
I need to import a lot of data into a sql server database. Some
'm using to Exhibit to, pretty simply, display some data on historical events and
I have some data that looks like this: 1: Events 2: Event 1 3:

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.