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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:19:37+00:00 2026-05-11T11:19:37+00:00

Let T1 and T2 are DataTable s with following fields T1(CustID, ColX, ColY) T2(CustID,

  • 0

Let T1 and T2 are DataTables with following fields

T1(CustID, ColX, ColY)  T2(CustID, ColZ) 

I need the joint table

TJ (CustID, ColX, ColY, ColZ) 

How this can be done in C# code in a simple way? Thanks.

  • 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. 2026-05-11T11:19:38+00:00Added an answer on May 11, 2026 at 11:19 am

    If you are allowed to use LINQ, take a look at the following example. It creates two DataTables with integer columns, fills them with some records, join them using LINQ query and outputs them to Console.

        DataTable dt1 = new DataTable();     dt1.Columns.Add('CustID', typeof(int));     dt1.Columns.Add('ColX', typeof(int));     dt1.Columns.Add('ColY', typeof(int));      DataTable dt2 = new DataTable();     dt2.Columns.Add('CustID', typeof(int));     dt2.Columns.Add('ColZ', typeof(int));      for (int i = 1; i <= 5; i++)     {         DataRow row = dt1.NewRow();         row['CustID'] = i;         row['ColX'] = 10 + i;         row['ColY'] = 20 + i;         dt1.Rows.Add(row);          row = dt2.NewRow();         row['CustID'] = i;         row['ColZ'] = 30 + i;         dt2.Rows.Add(row);     }      var results = from table1 in dt1.AsEnumerable()                  join table2 in dt2.AsEnumerable() on (int)table1['CustID'] equals (int)table2['CustID']                  select new                  {                      CustID = (int)table1['CustID'],                      ColX = (int)table1['ColX'],                      ColY = (int)table1['ColY'],                      ColZ = (int)table2['ColZ']                  };     foreach (var item in results)     {         Console.WriteLine(String.Format('ID = {0}, ColX = {1}, ColY = {2}, ColZ = {3}', item.CustID, item.ColX, item.ColY, item.ColZ));     }     Console.ReadLine();  // Output: // ID = 1, ColX = 11, ColY = 21, ColZ = 31 // ID = 2, ColX = 12, ColY = 22, ColZ = 32 // ID = 3, ColX = 13, ColY = 23, ColZ = 33 // ID = 4, ColX = 14, ColY = 24, ColZ = 34 // ID = 5, ColX = 15, ColY = 25, ColZ = 35 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a let's see if it can be done exercise more than anything
Let's say I have a table with a Color column. Color can have various
Let's take the following data: dt <- data.table(TICKER=c(rep(ABC,10),DEF), PERIOD=c(rep(as.Date(2010-12-31),10),as.Date(2011-12-31)), DATE=as.Date(c(2010-01-05,2010-01-07,2010-01-08,2010-01-09,2010-01-10,2010-01-11,2010-01-13,2010-04-01,2010-04-02,2010-08-03,2011-02-05)), ID=c(1,2,1,3,1,2,1,1,2,2,1),VALUE=c(1.5,1.3,1.4,1.6,1.4,1.2,1.5,1.7,1.8,1.7,2.3)) setkey(dt,TICKER,PERIOD,ID,DATE) Now for
Let's say I've got memory-based datatable like this: DataTable dt = new DataTable(); dt.Columns.Add(c1,
Let's say i have a datagrid with the following columns; DataTable dataTable66 = new
Let's say we have a simple table defined as: <p:dataTable value=#{testBean.dummyStringData} var=data> <p:column> <p:commandLink
Let's say I have the following data.table in R : library(data.table) DT = data.table(x=rep(c(b,a,c),each=3),
Let's say I have a DataTable: DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn(Country, typeof(string)));
Let me explain best with an example. Say you have node class that can
Let's say I have a sortable list like this: $(.song-list).sortable({ handle : '.pos_handle', axis

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.