# Retrieving related fields

**URL:** <https://forum.djangoproject.com/t/retrieving-related-fields/24646>\
**Category:** Using the ORM\
**Created:** [October 19, 2023, 12:57pm UTC](https://forum.djangoproject.com/t/retrieving-related-fields/24646 "2023-10-19T12:57:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SimonSellickSRA](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/simonsellicksra/32/16512_2.png) [@SimonSellickSRA](https://forum.djangoproject.com/u/SimonSellickSRA)\
**Post date:** [October 19, 2023, 12:57pm UTC](https://forum.djangoproject.com/t/retrieving-related-fields/24646/1 "2023-10-19T12:57:30Z")

</div>

Apologies in advance: this should be (and probably is) trivially simple, but I haven’t found the answer in the ‘models’ documentation.

Two models, **one** contains a foreign key to **two**. I want to retrieve a collection containing the whole of one, with each returned instance including a field from the related instance in two. In SQL, a simple equi-join from one to two and include two.field in the SELECT list. I want this to be done in one database ‘hit’.

What’s the syntax for this? And what have I either missed or misunderstood in the documentation?

Many thanks in advance for your answer (and your patience).

---

<div class="post-metadata">

**Author:** ![charettes](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/charettes/32/27_2.png) [@charettes](https://forum.djangoproject.com/u/charettes)\
**Post date:** [October 19, 2023, 1:21pm UTC](https://forum.djangoproject.com/t/retrieving-related-fields/24646/2 "2023-10-19T13:21:36Z")

</div>

Hello @SimonSellickSRA 👋

You are looking for [`select_related`](https://docs.djangoproject.com/en/4.2/ref/models/querysets/#select-related) so in your case something like

```python
Book.objects.select_related("author")

```

Which results in

```sql
SELECT
   book.*,
   author.*
FROM book
INNER JOIN author ON (book.author_id = author.id)

```
