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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:53:21+00:00 2026-06-16T14:53:21+00:00

Hey i’m trying to update a table and create an insert a row to

  • 0

Hey i’m trying to update a table and create an insert a row to another table.

I have this update query :

UPDATE logs_month SET status ='1'
WHERE DATE_FORMAT(month,"%m/%y") = '11/12' 

And i want it to be something like this:

UPDATE logs_month SET status ='1',
(INSERT INTO some_table (columns) values (values from the updated row))
WHERE DATE_FORMAT(month,"%m/%y") = '11/12' 

How can this be done?

I don’t want to use 2 queries because this update can accour several times a month and i want to insert only the rows currently updates to prevent duplicates without using unique indexes.

  • 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-16T14:53:22+00:00Added an answer on June 16, 2026 at 2:53 pm
    UPDATE logs_month SET status ='1'
    WHERE DATE_FORMAT(month,"%m/%y") = '11/12';
    COMMIT;
    INSERT INTO some_table (columns) values (select columns
    from logs_month where DATE_FORMAT(month,"%m/%y") = '11/12';
    

    You can do with TRIGGER also,

    DELIMITER $$
    CREATE TRIGGER `logs_m` 
    AFTER UPDATE ON `logs_month`
    FOR EACH ROW 
    BEGIN
        IF NEW.status=1 THEN
        INSERT INTO some_table (field) values (NEW.field);
        END IF;
    END$$
    
    DELIMITER ;
    

    You can do like this

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

Sidebar

Related Questions

hey guys having this really simple problem but cant seem to figure out have
Hey all i have a JSFiddle that i have been working on with trying
Hey I have following code like this public object RetrieveItemRun(int item) { if (dictionary.ContainsKey(item))
Hey all. I've been been trying to figure this out for a while now.
Hey folks, diving into jQuery and loving it. I have a set of links
Hey all- I have looked this up on here and Google but none of
Hey guys! I have this little problem: I have one ViewController which adds 2
Hey Folks i am trying to compile this C++ program: #include <stdio.h> #include <string.h>
Hey I have been looking all over the internet and this site for hours
Hey I'm having a problem trying to figure this out: Lets start out with

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.