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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T21:57:02+00:00 2026-06-02T21:57:02+00:00

I have read other posts and I really don’t understand what I am doing

  • 0

I have read other posts and I really don’t understand what I am doing wrong here because it is such a simple statement.

anything in ‘()’ are comments

Query:

[UPDATE users, sites 
SET users.idSiteRegUsers='1'
WHERE sites.SiteActivateSites='DEL' ]

(TBL’s to select to update within the whole query)
(Setting the users tbl idSiteRegUsers to 1)
(Where only the sites in tbl sites = DEL)

I’ve also read http://bugs.mysql.com/bug.php?id=52651 and tried changing the INT to VARCHAR and UPDATING 0 to DEL due to the bug but still same result.

Issue:

I have 2129 records that need updating as found using a simple select statement to understand the number of results.

([SELECT
sites.SiteActivateSites,
sites.id_Sites,
users.idSiteRegUsers,
users.CompanyNameUsers,
sites.LinkNameSites
FROM
users
INNER JOIN sites ON users.idSiteRegUsers = sites.id_Sites
WHERE
sites.SiteActivateSites != '1']) 'simple'

But the UPDATE query updates all 4000+ records, not just the records that = DEL but the ones that are reference to another value e.g. = 1.

Have I missed something?

Cheers,
Joe

  • 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-02T21:57:05+00:00Added an answer on June 2, 2026 at 9:57 pm

    Just as with your SELECT command, you need to tell MySQL how the tables are joined: your UPDATE is currently doing a full cartesian product of both tables (with every row in users joined with every row in sites – therefore the WHERE condition filtering on sites is still resulting in a match on every record from users).

    Try instead:

    UPDATE users JOIN sites ON users.idSiteRegUsers = sites.id_Sites
    SET    users.idSiteRegUsers='1'
    WHERE  sites.SiteActivateSites='DEL'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read the other posts, e.g., vim: Executing a list of editor commands
Okay guys, I have read through all the other posts and question on jQuery
I have read other related question but i cant really get them to relate
I have read this article from High Scalability about Stack Overflow and other large
I read up someplace, that there are characters other than A-Z that have a
I have read a lot of tutorials on Sync Adapter such as the tutorial
I have read a few posts on fail parameters for a JQuery Ajax call,
I've read a few other posts like this one about avoiding repetition in Java
I have read a lot of posts about how you can force lightbox (or
Other posts are outdated. Please don't close my post or vote it down. Could

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.