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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:04:06+00:00 2026-05-27T03:04:06+00:00

How do you insert selected rows from table_source to table_target using SQL in MySQL

  • 0

How do you insert selected rows from table_source to table_target using SQL in MySQL where:

  • Both tables have the same schema
  • All columns should transfer except for the auto-increment id
  • Without explicitly writing all the column names, as that would be tedious

The trivial INSERT INTO table_target SELECT * FROM table_source fails on duplicate entries for primary key.

  • 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-27T03:04:07+00:00Added an answer on May 27, 2026 at 3:04 am

    Either you list all of the fields you want in the insert…select, or you use something else externally to build the list for you.

    SQL does not have something like SELECT * except somefield FROM, so you’ll have to bite the bullet and write out the field names.

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

Sidebar

Related Questions

I need to duplicate selected rows with all the fields exactly same except ID
I have a number of rows from a database which I want to insert
I am Developing Windows Form Application in .Net, I want to insert selected rows
Like: insert into table (col) values (N'multilingual unicode strings') I'm using SQL Server 2008
I have two tables users registered_members I want to confirm values from user table
I have a stored proc which inserts rows from a view with ranks into
I'm retrieving information about resources from a MySQL database using PHP. The information about
What i want, to display rows from a table which is selected by a
I am processing items users have selected from a gridview, and performing an email
[Status: learner] Using checkboxes, the user selects rows from a displayed HTML table. I

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.