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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:50:04+00:00 2026-05-12T09:50:04+00:00

I have two tables: Table 1 has Episode and Code, with Episode as distinct.

  • 0

I have two tables:

  • Table 1 has Episode and Code, with Episode as distinct.
  • Table 2 has Episode and Code, but Episode is not distinct (other fields in the table, not relevant to the task, make each row unique).

I want to copy Table 1’s Code across to Table 2 for each episode. The current code to do this is as follows:

UPDATE Table2
SET Table2.Code = (SELECT TOP 1 Code FROM Table1 WHERE Episode = Table2.Episode)

This takes hours and hours. (I don’t know precisely how many hours, because I cancelled it at about the 20 hour mark.) They are big tables, but surely there’s a faster way?

  • 1 1 Answer
  • 3 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-12T09:50:04+00:00Added an answer on May 12, 2026 at 9:50 am

    I don’t have a SQL Server handy and I’m not completely sure, but I seem to recall there was a syntax like the following which should probably speed things up.

     UPDATE Table2 SET Table2.Code = Table1.Code FROM Table1 
     WHERE Table1.Episode = Table2.Episode
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables: products products_tmp The products_tmp table has less fields. But all
I have two tables, orders and old_orders. Each table has some similar fields and
I have a database framework where I have two tables. The first table has
I have two tables, one is a table of forum threads. It has a
I have two tables one has a three column composite key. The other needs
I have two tables: CREATE TABLE 'sales_sheet' ( `_id` int(11) NOT NULL AUTO_INCREMENT, `_typed_by`
I have two tables almost identical: employee employee_history The second table has two additional
I have two tables : DISH and DISH_HAS_DISHES. Dish table has all the dishes
I have two tables - 'business' and 'business_contacts'. The business_contact table has a many-to-one
Suppose I have two tables: Table A has information about the stock holdings of

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.