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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:30:54+00:00 2026-05-25T00:30:54+00:00

I have 2 tables as follows – table 1 – modelno, eqno, modeldet, modelcolor,…etc

  • 0

I have 2 tables as follows –

table 1 -  modelno, eqno, modeldet, modelcolor,...etc
table 2 - modelno, eqno, partno, modelinfo1, modeldet, modelplace....etc

in table 1 modelno and eqno is composite key
in table 2 modelno, eqno and partno are composite primary key.

In C# – I made a connection to database
first I fetch table 1 fields where clause based on modelno, then I have to fetch table 2 fields where clause based on modelno and eqno.

For example

table 1 -  modelno, eqno, modeldet, modelcolor
           1        1     redblue   red
           1        2     greenblue pink
           2        2     eeee      eeee 

table 2 - modelno, eqno, partno, modelinfo1, modeldet, modelplace
          1        1     1       ghhh         sss      ffff
          1        1     2       ffff         eee      rrrr
          2        1     1       dddd         ddd      dddd

I want to fetch first all the columns with modelno = ‘1’ from table 1.
and then foreach row fetched in above step get the rows from table2.
example after fetching the rows from table1 we get 2 rows.
then for first row fetched with modelid and eqno combination fetch the records from table2.

Is there a way in C# to connect to database only once and fetch the table1 and table2 information???
I dont want to connect twice to database first to get the table1 and then to get the table2.

  • 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-25T00:30:55+00:00Added an answer on May 25, 2026 at 12:30 am

    Use a JOIN in your SQL Query to do this:

    SELECT * FROM Table1 as t1
    LEFT JOIN Table2 as t2
    ON t1.ModelNo = t2.ModelNo
    

    This will return a row for every combination of Table 1 and table 2 based on a matching ModelNo

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables as follows: tblCountry (countryID, countryCode) tblProjectCountry(ProjectID, countryID) The tblCountry table
i have 2 tables, users and follows. table follows has a column named status.
I have two tables as follows, Table name Payment_transaction having column name as payment_ref_id,
I have two mySQL tables as follows: [product] table P_id | Name | Quantity
I have two tables as follows: CREATE TABLE customer ( id INT NOT NULL
I have 2 tables as follows : 1st table name bkq : at this
I have MYSQL tables as follows user TABLE {id INT} profile TABLE {user_id INT,
I have two tables that look as Follows: Person (Table Name) Name1/Phone1/Email1/Address1/Organization1/Notes1 (Fields) Organization
I have two tables as follows: Table user_prefs: user_prefs_id int(11) PK user_id int(11) item
I have SQL Server tables as follows: create table TableA ( id int primary

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.