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 89669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:45:10+00:00 2026-05-10T22:45:10+00:00

I have 2 tables, an active table and an inactive table. I want to

  • 0

I have 2 tables, an active table and an inactive table. I want to move rows from the active to the inactive table. My first thought was

insert into inactive select * from active where ... delete from active active where ... 

However about .42 seconds later I noticed this will drop/duplicate rows if updates alter what the where clause selects.

In this case, I can easily prevent that but what should I do in cases where I can’t?

edit: From the answers it look like there isn’t an easy/trivial way to do this. I’m really surprised by this. I would think that there would be some substantial benefits to having it.

  • 1 1 Answer
  • 1 View
  • 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. 2026-05-10T22:45:10+00:00Added an answer on May 10, 2026 at 10:45 pm

    Status flags are your friend.

    UPDATE old_data SET move='MARKED'; INSERT INTO somewhere... SELECT where move='MARKED'; DELETE FROM old_data WHERE move='MARKED'; 

    If you do this with Autocommit off, it will seize locks all over the place.

    You can COMMIT after each step, if you want to do a little less locking.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If all tables I want to delete from have the column gamer_id can i
I have a table structure as follows and I want to select all active
Hiii I have two tables Invited UID [pk] Active UID [pk] I want to
I have two tables, tblEntities and tblScheduling. tblEntities: EntityID ShortName Active 1 Dirtville 1
In my database I have tables that define types for example Table: Publication Types
I have 3 tables Links Link ID Link Name GroupID (FK into Groups) SubGroupID
I have two tables, omc_categories and omc_products. I want to pull out categories name
I have two tables, categories and products. I am using CodeIgniter. Categories CREATE TABLE
I have two tables.One table contain the values +---------+ Users ---------+ A B C
I have a script that appends some rows to a table. One of the

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.