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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:59:47+00:00 2026-06-01T09:59:47+00:00

I have two tables in my database that look like that: Customer: C_ID city

  • 0

I have two tables in my database that look like that:

Customer:

C_ID  city
--------------
1     Dhaka
2     New york
3     London

Personal_Info:

P_ID  C_ID  Field       value
-------------------------------
1     1     First Name  Nasir
2     1     Last Name   Uddin
3     2     First Name  Jon
4     3     First Name  Lee

I need a select result like that:

C_ID = ‘1’:

C_ID  Name (First Name + Last Name)  City
------------------------------------------
1     Nasir Uddin                    Dhaka

C_ID = ‘2’:

C_ID  Name (First Name + Last Name)  City
---------------------------------------------
2     Jon                            New york

How would the corresponding Linq query look like?

Thanks
Nahid

  • 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-01T09:59:48+00:00Added an answer on June 1, 2026 at 9:59 am

    Following a previous answer such as Linq to Sql: Multiple left outer joins you can see the structure for solving this eg something like:

    var result = from customer in customers  
                       from personalFirst in personal  
                           .Where(pf => pf.Field == "First Name" && pf.C_ID == customer.C_ID)  
                           .DefaultIfEmpty() 
                       from personalLast in personal  
                           .Where(pl => pl.Field == "Last Name" && pl.C_ID == customer.C_ID)  
                           .DefaultIfEmpty()  
                        where customer.C_ID == 2  
                        select new { customer.C_ID, Name = (personalFirst != null ? personalFirst.Value : "") + " " + (personalLast != null ? personalLast.Value : "") };  
    

    Obviously if you want all records then remove the restriction on C_ID = 2

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

Sidebar

Related Questions

I have two tables in a teradata database that look like this accounts account_number
I have a database that has two tables, these tables look like this codes
I have a database that consists of two tables, which look like this: users
so I have this problem. My Database has two tables that look something like
I have two tables in my database that look like this CREATE TABLE IF
I have two tables that I join on the id-column, they look like: +-------+
I have MySQL database with two tables: users and items. They look like this:
I have two tables in my database schema that represent an entity having a
I have two separate sets of tables in the same database that model the
I have a database two tables and a linking table that I need a

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.