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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:37:27+00:00 2026-05-25T06:37:27+00:00

The Query: UPDATE nominees SET votes = ( SELECT votes FROM nominees WHERE ID

  • 0

The Query:

UPDATE nominees SET votes = ( SELECT votes
FROM nominees
WHERE ID =1 ) +1

The Error:

You can’t specify target table ‘nominees’ for update in FROM

Not sure whats wrong there based on the error, this is the first time im tryin to incriment a column inline i guess you can call it. So I am obvioulsy doing something wrong but dont know how to fix it.

  • 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-25T06:37:28+00:00Added an answer on May 25, 2026 at 6:37 am

    Your UPDATE query is missing any WHERE clause so even if MySQL had allowed it then the effect would be to find the votes value for the ID =1 row add 1 to it then update all rows in the table with the result.

    I suspect that was not the desired behaviour. To increment the column value you just need to do

    UPDATE nominees 
    SET votes = votes +1
    WHERE ID =1 
    

    Just in case you do want the other behaviour you would need to do

    UPDATE nominees
    SET    votes = (select votes + 1
                    FROM   (SELECT votes
                            FROM   nominees
                            WHERE  ID = 1) T)  
    

    This wrapping into a derived table avoids the You can't specify target table 'nominees' for update in FROM error you were getting.

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

Sidebar

Related Questions

How do I formulate this query update forge..dimInteg2 set duplicates = (select count(*) from
I have this query: UPDATE student_info set grade = (SELECT tempTable.grade FROM tempTable WHERE
I have the following query: UPDATE PRODUCT SET FIXEDCOST = (Select PRICE from PRODUCTPROGRAM
I have following SQL UPDATE query: UPDATE Invoices SET Price = (SELECT SUM(Price*ProductsAndServices.Amount) FROM
Here is a sample query: UPDATE `table1` SET `table1`.`field1` = (SELECT COUNT(*) FROM `table2`
Assume I have the following query: Update LPMBonusReport Set BoxID = (Select ContainerSerialNumber From
Error SQL query: UPDATE `wfg_db`.`employee` SET `DOB` = (DECLARE@mm INT DECLARE@xm INT SET @mm
I want to update my sqlite table through query: UPDATE animals SET name =
I have a problem with this query: UPDATE Provinces SET Provinces.DefaultName=T2.Defaultname FROM Provinces INNER
I want to update a table: $result=mysql_query(select balance from tablename where userid='$userid)or die(mysql_error()); $row=mysql_fetch_assoc($result);

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.