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

  • Home
  • SEARCH
  • 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 6751075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:53:03+00:00 2026-05-26T12:53:03+00:00

I have a datatable Table called Table1 with primary key PId and child table

  • 0

I have a datatable Table called Table1 with primary key PId and child table called Table2 with PId as foreign key. My table structure is like

Table1
---

PId ,  Data1,

1 ,    ABS,

2  ,   DER,


Table2
---

TId,     PId,    Cid ,   Data2,

3 ,      1,     6 ,     FR,

4 ,      1  ,    66,  RE,

I need to fetch Cid from Table2 based on the Table1 Pid. Means For Pid 1 need to fetch 6 and 66.

Can anybody please help me to do it using LINQ or any c# code. Please dont mind, i dont know how to format the above data in stack overflow.

Regards

Pradeep

  • 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-26T12:53:04+00:00Added an answer on May 26, 2026 at 12:53 pm

    This would join the tables and select from table 2

            var results = from t1 in DataContext.Table1
                          join t2 in DataContext.Table2 on t1.Pid equals t2.Pid
                          where t1.Pid == 1
                          select t2.Cid;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I Have a table called Sur_Data and the data looks like: ID SV_Date 258
I have a DataTable which I want to save to a SQLite Database Table.
I have a method private static DataTable ParseTable(HtmlNode table) and sometimes this method has
I have a strongly typed DataTable created with the VS2005/VS2008 DataSet designer. The table
I have an table. I need to iterate, for each(datarow r in datatable.rows){ foreach(datacolumns
How to filter DataView/DataTable by time? I have a table with datetime column inside
I have a SQL 2008 table with a field called RecDate of type DateTimeOffset
Ok this is the scenario... I have a table in Oracle that acts like
I have a column in the data table called CurrentDate as datatype string (12/2/1983).
I have a DataSet called Apples. I need to massage the data table in

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.