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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:04:18+00:00 2026-05-21T02:04:18+00:00

For the sake of context, I am working on a 1 time data conversion

  • 0

For the sake of context, I am working on a 1 time data conversion from several Excel sheets that I have imported into a Database. The data is not normalized and I am trying to normalize it.

I have 3 tables in a SQL Database. They are called OldAssets, OldTransactions, and OldUsers.

OldTransactions has 7903 records. OldUsers has 7437. OldAssets has 9764

I am using LINQ to SQL to query these tables using this code

from oa in OldAssets
from ot in OldTransactions
from u in OldUsers
where (oa.Asset_Serial_Number == ot.Asset_Serial_Number  && ot.User_EID == u.User_EID  && ot.Asset_Tag == oa.Asset_Tag)
select new Transactions { 
            DevCenter = ot.Transaction_Dev_Center,
            Action  =   ot.Transaction_Action, 
            Status  =   ot.Transaction_Status,
            ModificationDate =  ot.Modified,
            ModifiedBy = ot.ModifiedBy,
            CreatedBy = ot.CreatedBy,
            TransactionDate = (System.DateTime)ot.Transaction_Date,
            Transaction_Asset = (System.Int32)oa.ID,
            Transaction_User = (System.Int32)u.ID }

I am trying to go through all of my OldTransactions and for each OldTransaction, create a new transaction that specifies the Transaction_Asset and the Transaction_User based on the mapping of an asset serial number and a user_EID.

My result is giving me just over 10,000 records of new “Transactions.” I don’t understand how I could be getting more records than the number of OldTransactions I have.

What query can I write that will return a single new Transaction for every OldTransaction, but with the added properties of Transaction_Asset and Transaction_User based on the mapping of serial_number and User_EID?

  • 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-21T02:04:18+00:00Added an answer on May 21, 2026 at 2:04 am

    From you question it looks like you just want to copy all transactions with additional data. I think something like this could work:

    from ot in OldTransactions
    select new Transactions {
            DevCenter = ot.Transaction_Dev_Center,
            Action  =   ot.Transaction_Action,
            Status  =   ot.Transaction_Status,
            ModificationDate =  ot.Modified,
            ModifiedBy = ot.ModifiedBy,
            CreatedBy = ot.CreatedBy,
            TransactionDate = (System.DateTime)ot.Transaction_Date,
            Transaction_Asset = (System.Int32)(
                 from oa in OldAssets 
                 where oa.Asset_Serial_Number == ot.Asset_Serial_Number && 
                       ot.Asset_Tag == oa.Asset_Tag
                 select oa.ID).FirstOrDefault(),
            Transaction_User = (System.Int32)(
                 from u in OldUsers 
                 where ot.User_EID == u.User_EID
                 select u.ID).
                     FirstOrDefault()) }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I have an iframe loaded that is accessed from the parent whenever it
For the sake of simplicity, let's say that we have input strings with this
I am working with some data that another person recorded using the OpenNI recorder
I'm working with Core Data for the first time and this has me stumped.
First some context: I have an MVC3 .net project which, for the sake of
For simplicities sake, I'll make up a similar example to what I have: Let's
For my curiosity sake I'm looking for a dynamic object oriented language that allows
This question is just for a sake of knowledge. I don't have any practical
Coming from a relational database background, as I'm sure many others are, I'm looking
Context menus seem to have a default white background. This looks pretty nice, but

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.