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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:35:50+00:00 2026-06-09T12:35:50+00:00

I am trying to use INSERT IGNORE INTO to add a row to a

  • 0

I am trying to use INSERT IGNORE INTO to add a row to a table if it doesn’t already exist.
Here is the statement as it stands right now:

INSERT IGNORE INTO my_table (integer, date) VALUES (11111, CURDATE())

However, since I have an auto-incrementing primary key on the table (that is not part of the insert of course), it always does the insert. Is there a way to disregard the primary key so that if the integer and date are already in the table it will not insert another row with them?

  • 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-09T12:35:51+00:00Added an answer on June 9, 2026 at 12:35 pm

    Put a UNIQUE key on the integer and the date, or the combination of the two – whichever fits your needs. That will prevent INSERT IGNORE from inserting values that violate the UNIQUE index.

    For example if you want to make the combination of the two unique:

    alter table my_table add unique index(integer, date)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use a BULK INSERT statement to populate a large (17-million-row) table
I'm trying to use jQuery to insert HTML into a table element. I've been
I'm trying to use an SQL insert statement to migrate rows from a table
'43.005895','-71.013202' Trying to use: INSERT INTO table(fanDetLocZip, fanDetLocCity, fanDetLocState, fanDetLocLat, fanDetLocLong, fanDetLocTZ, fanDetLocDST) VALUES(00210,
I'm trying to use SqlBulkCopy to insert new rows into my DB table by
I am trying to insert a row into a table, using a value that
I am trying to use the insert ignore statement to put a name in
I'm trying to use jQuery to add dynamic Add/Remove row function, but I meet
I am trying to use VBA to insert some text into a PowerPoint TextRange
I am currently trying to use a bulk insert from a temporary table 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.