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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:58:20+00:00 2026-06-08T10:58:20+00:00

My table has two keys, one is an auto incrementing id (PRIMARY), the other

  • 0

My table has two keys, one is an auto incrementing id (PRIMARY), the other is the name of the item (UNIQUE).

Is it possible to duplicate a row within this same table? I have tried:

INSERT INTO items
SELECT * FROM items WHERE id = '9198'

This gives the error Duplicate entry '9198' for key 'PRIMARY'

I have also tried:

INSERT INTO items
SELECT * FROM items WHERE id = '9198'
ON DUPLICATE KEY UPDATE id=id+1

Which gives the error Column 'id' in field list is ambiguous

And as far as the item name (UNIQUE) field goes, is there a way to append (Copy) to the item name, since this field must also be unique?

  • 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-08T10:58:22+00:00Added an answer on June 8, 2026 at 10:58 am

    Select all columns explicitly, except the id column:

    INSERT INTO items
    (col1, col2, ..., coln)
    SELECT col1, col2, ..., coln
    FROM items
    WHERE id = '9198'
    

    Your next question will probably be:

    Is there a way to do this without listing all the columns explicitly?

    Answer: No, I don’t think so.

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

Sidebar

Related Questions

I have two database tables: 'MyTable' which has a standard auto-incrementing primary key integer
I have three tables, table A has a unique primary key that is auto-incremented,
The table has only two column. One is key, the other is value. The
I have a table, tblNoComp, that has two columns, both foreign keys pointing to
Table A has two columns: ID and name I want to input 3 ID
I have a table that has two datetime columns (one for start time and
I have one table that has two fields - ID1 and ID2 ID1 can
I have a table that stores two foreign keys, implementing a n:m relationship. One
I have a table that has two foreign keys to two different tables with
I have a projects table which has two foreign keys for users (user_id and

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.