---
title: "How to get entities from multiple tables with one LINQ call?"  
description: "How to get entities from multiple tables with one LINQ call?"  
author: "Utpal Vishwas"  
published: 2023-09-05  
updated: 2023-09-06  
canonical: https://www.mindstick.com/forum/159849/how-to-get-entities-from-multiple-tables-with-one-linq-call  
category: "linq"  
tags: ["c#", "entity framework", "asp.net core"]  
reading_time: 2 minutes  

---

# How to get entities from multiple tables with one LINQ call?

How to get [entities](https://www.mindstick.com/blog/250/html-character-entities) from [multiple tables](https://www.mindstick.com/forum/159848/how-to-get-multiple-tables-using-entity-framework-core) with one [LINQ](https://www.mindstick.com/articles/12007/language-integrated-query-linq-queries) call?

## Replies

### Reply by Aryan Kumar

You can get entities from [multiple](https://www.mindstick.com/blog/12797/iowa-is-expected-to-see-heavy-growth-in-multiple-sectors) [tables](https://www.mindstick.com/articles/336597/introduction-of-html-tables-for-web-development) with a single LINQ call using the `Include` operator. You can load related entities from another table into the current entity using the include operator.

The syntax for `Include` operator is as follows:

```plaintext
from entity in source
include relatedEntity
```

where `entity` is the name of the entity loading the related entitiy and `relatedEntity` is the name of the related entity.

For example, the following code retrieves all the customers and their orders in a single LINQ call:

```plaintext
from customer in Customers
include customer.Orders
```

This code will first load all the customers from the `Customers` table. Then load all the orders for each customer from the `Orders` table.

You can also load multiple related entities in a single LINQ call using the include operator. For example, the following code gets all the customers, their orders, and the products that they ordered in a single LINQ call:

```plaintext
from customer in Customers
include customer.Orders
include customer.Orders.Products
```

This code will first loads all the customers from the `Customers` table. Then, load all the orders of each customer from the `Orders` table. Finally, all the products ordered by each customer are loaded from the Products table.


---

Original Source: https://www.mindstick.com/forum/159849/how-to-get-entities-from-multiple-tables-with-one-linq-call

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
