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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:42:07+00:00 2026-06-12T05:42:07+00:00

I have a table Datawarehouse which the population went wrong. Each row has a

  • 0

I have a table Datawarehouse which the population went wrong. Each row has a name and an ID and for each update in the original system, a new row in the DWH table is created that should maintain the same ID and Name of the affected object.

For some reason there was generation of duplicate IDs for the same Object (same name, knowing that name is also unique object wise not table wise, same as ID, it is not a table primary key, it is just an object ID).

Knowing that I have the following fields: ID, Name, IsLatest, what I need to do now is to fix the Data. For that the pseudo code I need to use is:

 1. Select the list of rows with the same Name
 2. Select the ID where IsLatest = 1
 3. Update the rest of rows with that ID

I had issue with the update query, I was not able to select only one ID, and I was not also able to loop on different names.

  • 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-12T05:42:08+00:00Added an answer on June 12, 2026 at 5:42 am

    This can be completed using a correlated sub-query:

    UPDATE DWH
    SET id = (
        SELECT id
        FROM DataWarehouse
        WHERE DWH.name = name
            AND isLatest = 1
        )
    FROM DataWarehouse DWH
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one data warehouse table that contain one row for each item sold.
I have table TB1 which has the following cols: ID | date --------------------- 1
i have table from database this table has 400000 row in my asp page
I have table in which I am inserting rows for employee but next time
I have table Players with columns: ID Name Points What is most efficient way
I have table categories (c) and an another table (x) with a column which
All, I have to create a single database which has a basic schema. This
I have a table in my SQL Server where I stage my datawarehouse extract
I have Table with columns: Month and Year, and other data. All row in
I have table with around 70 000 rows. There is 6000 rows that i

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.