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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:09:31+00:00 2026-06-17T09:09:31+00:00

I have a little problem. This is the SQL code I get: INSERT INTO

  • 0

I have a little problem.

This is the SQL code I get:

INSERT INTO matches (match_id, league_name, league_id, test_one) 
VALUES (866860, 'Portugal',1,'testing') 
ON DUPLICATE KEY 
UPDATE league_name = 
  CASE match_id 
    WHEN 866860 
      THEN 'Portugal' END, 
league_id = 
  CASE match_id 
    WHEN 866860 
      THEN 1 END, 
test_one = 
  CASE match_id 
    WHEN 866860 
      THEN 'testing' END

The problem is, that it always insert a new row instead of updating the existing one.
Is it because I need to make the “match_id” as AUTO_INCREMENT or anything else (at the moment, my “id” field is AUTO_INCREMENT)

  • 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-17T09:09:32+00:00Added an answer on June 17, 2026 at 9:09 am

    AUTO_INCREMENT is irrelevant here. But ON DUPLICATE KEY requires a key. More specifically, a unique key, such as primary key or a unique index.

    Given the column names, I suspect that match_id fails to be a primary key.

    Update: You also write a complicate set of CASE ... END constructs. Have a look at the VALUES() function.

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

Sidebar

Related Questions

I have a little problem. This is my code: stackPanelShapesContainer = new StackPanel(); InitializeStackPanle();
I have this little problem, that I cannot figure out which arguments to pass
I have this little problem. My client wanted two distinct swf on a web
I'm having a trouble with this little problem. Let's say, I have an array,
Alright, this problem is a little complicated, so bear with me. I have a
(SQLite and C#) I have this little problem. See those 2 tables. 1. is
I have the following SQL design issue. The code below might look a little
i have a little problem here: i have a combobox that gets its values
lets get straight to my problem, the code I have written here does not
I have little problem with a replacement of a little part in an url.

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.