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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:15:01+00:00 2026-06-16T01:15:01+00:00

Below you can see my simplified DB model: Due to an error there are

  • 0

Below you can see my simplified DB model:

enter image description here

Due to an error there are only null-values in the column Job.location where the entries belong to a certain Plan. Therefore I want to update all Jobs associated with this Plan, setting Job.location to Location.name of the User, who owns this Plan.

I tried this SQL query:

    update dbo.Job set location =

        (select name from dbo.Location as loc where

           loc.objectid = objectid  and loc.user_id in 

           (select userid from dbo.[Plan] as p where p.planid = 20))

        where planid = 20

However, the result is always: 0 rows affected. The subqueries itself work correctly.

How can I achieve that all Jobs with a certain planid are affected?

  • 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-16T01:15:02+00:00Added an answer on June 16, 2026 at 1:15 am

    I think you mistake may be that you have no alias for objectid column in subquery loc.objectid = objectid, so when you running subquery by itself, it just works like loc.objectid = loc.objectid and when you running it in the update, it works like loc.objectid = dbo.Job.objectid

    In your schema it’s possible to have multiple locations for users, but supposing you have only one location per user and object, you can try this query:

    update dbo.Job set
        location = L.Name
    from dbo.Job as J
        inner join dbo.[Plan] as P on P.planid = J.planid
        inner join dbo.Location as L on L.user_id = P.userid and L.objectid = J.objectid
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the diagram below you can see a simplified version of what I'm trying
As you can see below, I have Parallel.For loop. If run the program while
In my application I have an edit profile page which you can see below;
I'm using graphviz (dot) to generate the graph you can see below. The node
I have two async classes in my application which you can see below class
i have a pretty complicated form. as you can see below: alt text http://img9.imageshack.us/img9/2465/test2xk.jpg
Trying not to lose it here. As you can see below I have assigned
as you can see the class below declares 2 private instance variables and 2
Hi below link from Vaadin you can see how to set checkboxes on tabletree,
Screenshots Below. As you can see, my menubutton is showing up in the actionBar's

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.