Jump to content

move table due in 10 days time


Go to solution Solved by Frank_b,

Recommended Posts

Don't do that - have multiple tables for the same thing. The big clue that it's a bad idea is that you have to run some automated thing to manage your database.

 

Any particular reason you want them in another table? Is there a problem with just querying the table directly?

  • Solution
SELECT * FROM orders WHERE DATEDIFF( duedate, CURRENT_DATE()) <= 10

That is enough to show only orders that are equal or less to 10 days before the column duedate.

 

Like requinix said: Do not move them to another table. That is bad practise.

 

ps. i assumed that you have a duedate column with the type DATE or DATETIME.

Edited by Frank_b

Hopefully you have realized that good database organization is how you properly manage any and all data.  By having it well designed you are then able to write queries to answer any question at any time without having to do things like you proposed in your post.  No need to move data to another table, no need to remove data when it 'expires'.  You simply store your data and query it and format the output to answer any question that is asked.  Yes - you eventually may remove data that is beyond use, but I suggest that you develop a process to archive the old data so that you can analyze it over long periods of time if that is the nature of your activity/business.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.