Sometimes we may want to create mapping in content types. Say, i created an Artist and a Song content types. when i select an artist, i want it to select all the songs which belongs to that artist also. In that case, we need a node reference field in the Artist content type such that every song is mapped to an artist.
So first, create the Song content type with default fields. Then create some songs and fill in the lyrics as node body.
Next, create the Artist content type and add a node reference field.
Since it is a one to many mapping(one artist can have many songs), set the number of values to Unlimited and reference node to Song.
Create the artist and select the reference songs.
The contents are ready and now i am going to create a view which contains the Artist name, the Song Name and the Song Lyrics.
First create a view and add a page display. Add a new Relationship and pick Content: Reference Song (field_reference_song). Select Require this relationship.
Add a Node: Title field without relationship setting. This will be the Artist Name.
Add another Node: Title field with relationship set to Reference Song. This will be the Song Name.
Also add the Node: Body of Reference Song. The overall settings will be
Browse the page you just create.
Done =)
Reference: Create a view on a node reference field