Add a relationship to a view
Last updated on
1 December 2021
This documentation needs work. See "Help improve this page" in the sidebar.
When you first create a view you select the base table from options such as Comments, Content, and Taxonomy terms. This cannot be changed later. After that selection, you will only be able to select fields from that base table. For example, with a Content view, you can get the User ID of the author, but not the author's username. To get that information you will need to create a Relationship to join those two tables. With the connection of User ID, you can get the author's username from the User table.
- Navigate to the edit screen of a view (for example, admin/structure/views/MY_VIEW_NAME ) In this case we're editing a Content listing.
- In the right column, click Advanced.
- In the Relationships area, click Add.
- There are many tables you can join to the content listing. In this case, search for "author" options, and select Content: Content author. Click Apply.

- Next, you can set the administrative title, though the default should be sensible enough. You can also opt to "Require this relationship. This will hide content which doesn't have the relationship. Click Apply.
- Under Fields click Add.
- Search for your chosen relationship, such as User. Now you will have more fields available from the joined table, in this case, the User table. Select User: Name. Click Apply.

- Next, you can configure how the field displays. The defaults, in this case, will append a field label and make the field a link to the user. Change the label to Author. Click Apply.
- Check your preview to see your content listing, including the author's username.

Help improve this page
Page status: Needs work
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion