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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:31:22+00:00 2026-06-06T00:31:22+00:00

I want many values to be simultaneously inserted in my table having only 2

  • 0

I want many values to be simultaneously inserted in my table having only 2 columns and if those values already exists then it has to be updated.. Though duplication for 1 column is possible but not for the second column.. I can easily do it with the following query.. But the problem is here only one row can only be considered… There are no primary keys.. PLZ HELP

INSERT INTO `table` (value1, value2) 
SELECT 'stuff for value1', 'stuff for value2' FROM `table` 
WHERE NOT EXISTS (SELECT * FROM `table` 
                  WHERE value1='stuff for value1' AND value2='stuff for value2') 
LIMIT 1
  • 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-06T00:31:24+00:00Added an answer on June 6, 2026 at 12:31 am

    Try this
    Insert into table name………….
    on duplicate key update set column1=……

    Alternative way ::

    Step1 : Create a temp_table with same structure of that of table1

    Step 2:

        INsert into temp_Table 
       (SELECT * from table1 t1 left join table2 t2 on (t1.value1=t2.value1 and t1.value2=t2.value2)
        where t2.value1 is null and t2.value2 is null);
    

    Step3:

      INsert into table Select * from temp_table 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to submit a form that have many checkboxes with different values, using
I have a function in .CS file. i want to return many values fetched
I have a tableView with many values. I want to get the first indexPath.row
I have a listview with many values. I want my first row to be
The table has only two column. One is key, the other is value. The
Probably many coders want to ask this question. it is What's the adventages of
I want to simulate many key press events. I found a solution by using
I want to use many bars like this one in my app (i don't
I want to make many inserts in a single SQL statement, pretty much like
I want to insert many rows in front of the last row in a

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.