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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:04:43+00:00 2026-05-20T18:04:43+00:00

I am attempting to do an UPDATE with a JOIN. I have two tables:

  • 0

I am attempting to do an UPDATE with a JOIN. I have two tables:

  • player_tracking has a list of all
    players that each user has added to
    tracking.
  • users is the user list. each user
    can set fsp_f to 1 or 0.

I want to update all rows in player_tracking for users who have fsp_f set to 1. Here is my example code:

   UPDATE player_tracking AS pt 
LEFT JOIN users AS u ON u.name = pt.user 
      SET pt.newtome = pt.newtome - 1 
   WHERE pt.first = 'Brett' 
     AND pt.last = 'Gardner' 
     AND pt.sport = 'mlb' 
     AND u.fsp_f = 1 

The problem is that there are 22 rows to update, yet the UPDATE query only affects 2. Why? Is my query wrong?

Here is the data found in player_tracking pertaining to “Brett” “Gardner” “mlb”:
http://pastebin.com/kyf8SCy8

  • 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-20T18:04:43+00:00Added an answer on May 20, 2026 at 6:04 pm

    i believe that if you change the LEFT JOIN to JOIN you will see the exact rows that get updated since you are using a field form users in the WHERE part of the statement.

    so basically you are trying to check if u.fsp_f = 1 when there could be rows that do not join users and therefore will have the value as NULL.

    Additionally it seems that the general layout of your query is not correct either, since you are joining on the SET statement and not in the UPDATE part – where you instructed which table to update

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

Sidebar

Related Questions

I am attempting to delete all rows in two dependent tables based on a
I've encountered a strange error when attempting to update a SharePoint 2010 list that
Attempting to print out a list of values from 2 different variables that are
I am attempting to update to Hibernate 4 and I am getting that org.hibernate.annotations.Entity
I am running a tomcat server and am attempting to update code on that
I'm attempting to update a table using a join statement, but it isn't exactly
I’m attempting to use ADO.NET Data Services to update my database. Tables: Person( PK
I have a data set that i am attempting to select the first record
While attempting to update all my ports / installed ports with portmaster. I receive
I have a set of data that has been displayed as just a simple

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.