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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:53:43+00:00 2026-06-11T20:53:43+00:00

I have a statement that needs writing (with generic names for stuff, since this

  • 0

I have a statement that needs writing (with generic names for stuff, since this is for work) to update a column ‘updCol’ in table ‘tUpd’. tUpd also has a column ‘linkCol’ which is present in another table tOther. tOther has another column ‘idCol’.

My problem is to update the updCol value of rows in tUpd which correspond via linkCol to rows with a given idCol value.

One solution I think should work is the following;

update
    tUpd
set
    updCol = XXX
where exists (
    select
        idCol
    from
        tOther
    where
        tOther.linkCol = tUpd.linkCol
    and tOther.idCol = MY_ID
)

However, I have worries that this approach will lead to poor performance, since I’ve been warned of sub-queries in relation to performance before – this sub-query will be run once for each row of tUpd, is this correct?

Has anyone got a better suggestion?

Important Update: my workplace avoids using SQL JOINs at all costs, preferring to join within the where clauses using, eg, where a.col = b.col. This is arguably rather awkward but allows a flexibility in especially logging which I don’t fully understand. SO, I’m looking for non-JOIN-using solutions 🙂

  • 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-11T20:53:44+00:00Added an answer on June 11, 2026 at 8:53 pm

    Its simply like this

    UPDATE DestinationTable
    SET DestinationTable.UpdateColumn =  SourceTable.UpdateColumn 
    FROM SourceTable
    WHERE DestinationTable.JoinColumn = SourceTable.JoinColumn
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an if statement that needs to look like this: UPDATE $(input#textbox).keypress(function(e){ key==e.which;
I have the following statement that I need to run on a table which
I have a statement similar to this that I need to run in Linq.
I have an UPDATE statement that's intended to update a status field for a
I have a sql statement that uses Difference => http://msdn.microsoft.com/en-us/library/ms188753.aspx I do this in
This is a generic C++ design question. I'm writing an application that uses a
I'm writing a SQL statement to select a user on a table if that
I'm writing a stored procedure that needs to have a lot of conditioning in
I have a LINQ statement that returns an anonymous type. I need to get
I have a case statement that returns a date; case when (ma.first_active_date is not

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.